Struct Comparator

pub struct Comparator { pub op: Op, pub major: u64, pub minor: Option<u64>, pub patch: Option<u64>, pub pre: Prerelease }

A pair of comparison operator and partial version, such as >=1.2. Forms one piece of a VersionReq.

Fields

op: Op
major: u64
minor: Option<u64>
patch: Option<u64>

Patch is only allowed if minor is Some.

pre: Prerelease

Non-empty pre-release is only allowed if patch is Some.

Implementations

impl Comparator

fn parse(text: &str) -> Result<Self, Error>
fn matches(&self, version: &Version) -> bool

Trait Implementations

impl Clone for Comparator

fn clone(&self) -> Comparator

impl Debug for Comparator

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl Display for Comparator

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

impl Eq for Comparator

impl FromStr for Comparator

type Err = Error;
fn from_str(text: &str) -> Result<Self, Self::Err>

impl Hash for Comparator

fn hash<__H: Hasher>(&self, state: &mut __H)

impl PartialEq for Comparator

fn eq(&self, other: &Comparator) -> bool

impl Serialize for Comparator

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
    S: Serializer,

impl StructuralPartialEq for Comparator

impl<'de> Deserialize<'de> for Comparator

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
    D: Deserializer<'de>,

Auto Trait Implementations

impl Freeze for Comparator

impl RefUnwindSafe for Comparator

impl Send for Comparator

impl Sync for Comparator

impl Unpin for Comparator

impl UnsafeUnpin for Comparator

impl UnwindSafe for Comparator

Blanket Implementations

impl<T> Any for Comparator where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for Comparator where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Comparator where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> CloneToUninit for Comparator where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> DeserializeOwned for Comparator where T: for<'de> Deserialize<'de>,

impl<T> From<T> for Comparator

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Comparator where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T> ToString for Comparator where T: Display + ?Sized,

fn to_string(&self) -> String

impl<T, U> Into<U> for Comparator where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for Comparator where U: Into<T>,

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Comparator where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>