Struct cargo_feature_matrix::features::Feature
source · [−]pub struct Feature<'f>(_);Methods from Deref<Target = Cow<'f, str>>
sourcepub fn is_borrowed(&self) -> bool
🔬 This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_borrowed(&self) -> bool
cow_is_borrowed)Returns true if the data is borrowed, i.e. if to_mut would require additional work.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());
let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());sourcepub fn is_owned(&self) -> bool
🔬 This is a nightly-only experimental API. (cow_is_borrowed)
pub fn is_owned(&self) -> bool
cow_is_borrowed)Returns true if the data is owned, i.e. if to_mut would be a no-op.
Examples
#![feature(cow_is_borrowed)]
use std::borrow::Cow;
let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());
let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());1.0.0 · sourcepub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned
pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned
Acquires a mutable reference to the owned form of the data.
Clones the data if it is not already owned.
Examples
use std::borrow::Cow;
let mut cow = Cow::Borrowed("foo");
cow.to_mut().make_ascii_uppercase();
assert_eq!(
cow,
Cow::Owned(String::from("FOO")) as Cow<str>
);Trait Implementations
sourceimpl<'f, __AsMutT: ?Sized> AsMut<__AsMutT> for Feature<'f> where
Cow<'f, str>: AsMut<__AsMutT>,
impl<'f, __AsMutT: ?Sized> AsMut<__AsMutT> for Feature<'f> where
Cow<'f, str>: AsMut<__AsMutT>,
sourceimpl<'f, __AsRefT: ?Sized> AsRef<__AsRefT> for Feature<'f> where
Cow<'f, str>: AsRef<__AsRefT>,
impl<'f, __AsRefT: ?Sized> AsRef<__AsRefT> for Feature<'f> where
Cow<'f, str>: AsRef<__AsRefT>,
sourceimpl<'de, 'f> Deserialize<'de> for Feature<'f>
impl<'de, 'f> Deserialize<'de> for Feature<'f>
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<'f> FromIterator<Feature<'f>> for FeatureSet<'f>
impl<'f> FromIterator<Feature<'f>> for FeatureSet<'f>
sourcefn from_iter<T: IntoIterator<Item = Feature<'f>>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Feature<'f>>>(iter: T) -> Self
Creates a value from an iterator. Read more
sourceimpl<'f> Ord for Feature<'f>
impl<'f> Ord for Feature<'f>
sourceimpl<'f> PartialOrd<Feature<'f>> for Feature<'f>
impl<'f> PartialOrd<Feature<'f>> for Feature<'f>
sourcefn partial_cmp(&self, other: &Feature<'f>) -> Option<Ordering>
fn partial_cmp(&self, other: &Feature<'f>) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
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 more
impl<'f> Eq for Feature<'f>
impl<'f> StructuralEq for Feature<'f>
impl<'f> StructuralPartialEq for Feature<'f>
Auto Trait Implementations
impl<'f> RefUnwindSafe for Feature<'f>
impl<'f> Send for Feature<'f>
impl<'f> Sync for Feature<'f>
impl<'f> Unpin for Feature<'f>
impl<'f> UnwindSafe for Feature<'f>
Blanket Implementations
impl<T> AsUncased for T where
T: AsRef<str> + ?Sized,
impl<T> AsUncased for T where
T: AsRef<str> + ?Sized,
pub fn as_uncased(&self) -> &UncasedStr
pub fn as_uncased(&self) -> &UncasedStr
Convert self to an [UncasedStr].
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more