Enum cargo_update::ops::PackageFilterElement
source · [−]pub enum PackageFilterElement {
Toolchain(String),
}
Expand description
One of elements with which to filter required packages.
Variants
Toolchain(String)
Requires toolchain to be specified to the specified toolchain.
Parsed name: "toolchain"
.
Implementations
sourceimpl PackageFilterElement
impl PackageFilterElement
sourcepub fn parse(from: &str) -> Result<PackageFilterElement, String>
pub fn parse(from: &str) -> Result<PackageFilterElement, String>
Parse one filter specifier into up to one package filter
Examples
assert_eq!(PackageFilterElement::parse("toolchain=nightly"),
Ok(PackageFilterElement::Toolchain("nightly".to_string())));
assert!(PackageFilterElement::parse("capitalism").is_err());
assert!(PackageFilterElement::parse("communism=good").is_err());
sourcepub fn matches(&self, cfg: &PackageConfig) -> bool
pub fn matches(&self, cfg: &PackageConfig) -> bool
Check if the specified package config matches this filter element.
Examples
assert!(PackageFilterElement::Toolchain("nightly".to_string())
.matches(&PackageConfig::from(&[ConfigOperation::SetToolchain("nightly".to_string())])));
assert!(!PackageFilterElement::Toolchain("nightly".to_string()).matches(&PackageConfig::from(&[])));
Trait Implementations
sourceimpl Clone for PackageFilterElement
impl Clone for PackageFilterElement
sourcefn clone(&self) -> PackageFilterElement
fn clone(&self) -> PackageFilterElement
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for PackageFilterElement
impl Debug for PackageFilterElement
sourceimpl Hash for PackageFilterElement
impl Hash for PackageFilterElement
sourceimpl Ord for PackageFilterElement
impl Ord for PackageFilterElement
sourcefn cmp(&self, other: &PackageFilterElement) -> Ordering
fn cmp(&self, other: &PackageFilterElement) -> Ordering
1.21.0 · sourceconst fn max(self, other: Self) -> Self
const fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourceconst fn min(self, other: Self) -> Self
const fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourceconst fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
const fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<PackageFilterElement> for PackageFilterElement
impl PartialEq<PackageFilterElement> for PackageFilterElement
sourcefn eq(&self, other: &PackageFilterElement) -> bool
fn eq(&self, other: &PackageFilterElement) -> bool
sourceimpl PartialOrd<PackageFilterElement> for PackageFilterElement
impl PartialOrd<PackageFilterElement> for PackageFilterElement
sourcefn partial_cmp(&self, other: &PackageFilterElement) -> Option<Ordering>
fn partial_cmp(&self, other: &PackageFilterElement) -> Option<Ordering>
1.0.0 · sourceconst fn le(&self, other: &Rhs) -> bool
const fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for PackageFilterElement
impl StructuralEq for PackageFilterElement
impl StructuralPartialEq for PackageFilterElement
Auto Trait Implementations
impl RefUnwindSafe for PackageFilterElement
impl Send for PackageFilterElement
impl Sync for PackageFilterElement
impl Unpin for PackageFilterElement
impl UnwindSafe for PackageFilterElement
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more