pub struct PublishAgePolicy {
invocation_time: Timestamp,
global: MinPublishAge,
crates_io: MinPublishAge,
per_registry: HashMap<String, MinPublishAge>,
}Expand description
Snapshot of the min-publish-age configuration before resolution started.
Fields§
§invocation_time: TimestampReference “now” from GlobalContext::invocation_time.
global: MinPublishAgeregistry.global-min-publish-age
crates_io: MinPublishAgeregistry.min-publish-age
per_registry: HashMap<String, MinPublishAge>registries.<name>.min-publish-age
Implementations§
Source§impl PublishAgePolicy
impl PublishAgePolicy
Sourcepub fn new(gctx: &GlobalContext) -> CargoResult<Option<Self>>
pub fn new(gctx: &GlobalContext) -> CargoResult<Option<Self>>
Builds the policy from min-publish-age configuration.
Returns None when either meets
- the
-Zmin-publish-agegate is off - the resolver is configured to allow pubtime-incompatible versions
- no threshold is configured at all
Sourcepub fn for_report(gctx: &GlobalContext) -> CargoResult<Option<Self>>
pub fn for_report(gctx: &GlobalContext) -> CargoResult<Option<Self>>
Like PublishAgePolicy::new but ignore config from [resolver],
so it report too-new packages regardess they are allowed or denied.
Sourcepub fn too_new(&self, summary: &Summary) -> Option<PublishAgeViolation>
pub fn too_new(&self, summary: &Summary) -> Option<PublishAgeViolation>
Returns the version’s publish-age if it is too new for its registry.
None means the version is acceptable.
Sourcefn min_age(&self, source_id: SourceId) -> &MinPublishAge
fn min_age(&self, source_id: SourceId) -> &MinPublishAge
Resolves the minimum publish age for a given registry source.
Priority:
registries.<name>.min-publish-ageregistry.min-publish-ageregistry.global-min-publish-age
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PublishAgePolicy
impl RefUnwindSafe for PublishAgePolicy
impl Send for PublishAgePolicy
impl Sync for PublishAgePolicy
impl Unpin for PublishAgePolicy
impl UnsafeUnpin for PublishAgePolicy
impl UnwindSafe for PublishAgePolicy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 128 bytes