pub struct StringVersion {
pub string: String,
pub version: Version,
}Expand description
Helper type with a Version and its original text
Fields§
§string: StringOriginal unchanged string
version: VersionParsed version
Methods from Deref<Target = Version>§
Sourcepub fn any_prerelease(&self) -> bool
pub fn any_prerelease(&self) -> bool
Whether this is an alpha/beta/rc or dev version
Sourcepub fn is_stable(&self) -> bool
pub fn is_stable(&self) -> bool
Whether this is a stable version (i.e., not an alpha/beta/rc or dev version)
Sourcepub fn is_local(&self) -> bool
pub fn is_local(&self) -> bool
Whether this is a local version (e.g. 1.2.3+localsuffixesareweird)
When true, it is guaranteed that the slice returned by
Version::local is non-empty.
Sourcepub fn pre(&self) -> Option<Prerelease>
pub fn pre(&self) -> Option<Prerelease>
Returns the pre-release part of this version, if it exists.
Sourcepub fn local(&self) -> LocalVersionSlice<'_>
pub fn local(&self) -> LocalVersionSlice<'_>
Returns the local segments in this version, if any exist.
Sourcepub fn min(&self) -> Option<u64>
pub fn min(&self) -> Option<u64>
Returns the min-release part of this version, if it exists.
The “min” component is internal-only, and does not exist in PEP 440.
The version 1.0min0 is smaller than all other 1.0 versions,
like 1.0a1, 1.0dev0, etc.
Sourcepub fn max(&self) -> Option<u64>
pub fn max(&self) -> Option<u64>
Returns the max-release part of this version, if it exists.
The “max” component is internal-only, and does not exist in PEP 440.
The version 1.0max0 is larger than all other 1.0 versions,
like 1.0.post1, 1.0+local, etc.
Sourcepub fn only_release(&self) -> Version
pub fn only_release(&self) -> Version
Return the version with any segments apart from the release removed.
Sourcepub fn only_minor_release(&self) -> Version
pub fn only_minor_release(&self) -> Version
Return the version with any segments apart from the minor version of the release removed.
Sourcepub fn only_release_trimmed(&self) -> Version
pub fn only_release_trimmed(&self) -> Version
Return the version with any segments apart from the release removed, with trailing zeroes trimmed.
Trait Implementations§
Source§impl Clone for StringVersion
impl Clone for StringVersion
Source§fn clone(&self) -> StringVersion
fn clone(&self) -> StringVersion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StringVersion
impl Debug for StringVersion
Source§impl Deref for StringVersion
impl Deref for StringVersion
Source§impl<'de> Deserialize<'de> for StringVersion
impl<'de> Deserialize<'de> for StringVersion
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl Display for StringVersion
impl Display for StringVersion
Source§impl From<Version> for StringVersion
impl From<Version> for StringVersion
Source§impl FromStr for StringVersion
impl FromStr for StringVersion
Source§impl Hash for StringVersion
impl Hash for StringVersion
Source§impl PartialEq for StringVersion
impl PartialEq for StringVersion
Source§impl Serialize for StringVersion
impl Serialize for StringVersion
impl Eq for StringVersion
impl StructuralPartialEq for StringVersion
Auto Trait Implementations§
impl Freeze for StringVersion
impl RefUnwindSafe for StringVersion
impl Send for StringVersion
impl Sync for StringVersion
impl Unpin for StringVersion
impl UnwindSafe for StringVersion
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.