Cow

Struct Cow 

Source
pub struct Cow<'a, T>
where T: ?Sized + Dairy<'a>,
{ /* private fields */ }
Expand description

A clone-on-write smart pointer.

The type Cow is a smart pointer providing clone-on-write functionality: it can enclose and provide immutable access to borrowed data, and clone the data lazily when mutation or ownership is required.

Cow implements Deref, which means that you can call non-mutating methods directly on the data it encloses.

Implementations§

Source§

impl<'a, T> Cow<'a, T>
where T: ?Sized + Dairy<'a>,

Source

pub fn borrowed(b: &'a T) -> Self

Construct from borrowed data.

§Examples
use dairy::Cow;
let cow: Cow<str> = Cow::borrowed("moo");
Source

pub fn owned(o: T::Owned) -> Self

Construct from owned data.

§Examples
use dairy::Cow;
let cow: Cow<str> = Cow::owned(String::from("moo"));
Source

pub fn is_borrowed(&self) -> bool

Returns true if the data is borrowed.

§Examples
use dairy::Cow;

let cow: Cow<str> = Cow::borrowed("moo");
assert!(cow.is_borrowed());

let cow: Cow<str> = Cow::owned(String::from("...moo?"));
assert!(!cow.is_borrowed());
Source

pub fn is_owned(&self) -> bool

Returns true if the data is owned.

§Examples
use dairy::Cow;

let cow: Cow<str> = Cow::owned(String::from("moo"));
assert!(cow.is_owned());

let cow: Cow<str> = Cow::borrowed("...moo?");
assert!(!cow.is_owned());
Source

pub fn into_owned(self) -> T::Owned

Converts into owned data.

Clones the data if it is not already owned.

§Examples

Calling .into_owned() on a borrowed Cow clones the underlying data.

use dairy::Cow;

let cow = Cow::borrowed("Moo!");
assert_eq!(cow.into_owned(), String::from("Moo!"));

Calling .into_owned() on an owned Cow is a noop.

use dairy::Cow;

let cow: Cow<str> = Cow::owned(String::from("Moo!"));
assert_eq!(cow.into_owned(), String::from("Moo!"));
Source

pub fn into_boxed(self) -> Box<T>
where T: ToBoxed,

Converts into boxed data.

Clones the data if it is not already owned.

§Examples

Calling .into_boxed() on a borrowed Cow clones the underlying data.

use dairy::Cow;

let cow = Cow::borrowed("Moo!");
assert_eq!(cow.into_boxed(), String::from("Moo!").into_boxed_str());

Calling .into_boxed() on an owned Cow is a noop.

use dairy::Cow;

let cow: Cow<str> = Cow::owned(String::from("Moo!"));
assert_eq!(cow.into_boxed(), String::from("Moo!").into_boxed_str());
Source

pub fn apply<F>(&mut self, f: F)
where F: FnOnce(&mut T::Owned),

Applies the given function to the owned data.

Clones the data if it is not already owned. This is useful because the compact implementation is not able to provide a .to_mut() method like the standard library. This function allows you to modify the Cow without moving it.

§Examples
use dairy::Cow;

let mut cow = Cow::borrowed("Moo!");
cow.apply(|s| s.make_ascii_uppercase());
assert_eq!(cow, "MOO!");

Trait Implementations§

Source§

impl AsRef<[u8]> for Cow<'_, str>

Source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<OsStr> for Cow<'_, Path>

Source§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<OsStr> for Cow<'_, str>

Source§

fn as_ref(&self) -> &OsStr

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Path> for Cow<'_, OsStr>

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<Path> for Cow<'_, str>

Source§

fn as_ref(&self) -> &Path

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T> AsRef<T> for Cow<'a, T>
where T: ?Sized + Dairy<'a>,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T> Borrow<T> for Cow<'a, T>
where T: ?Sized + Dairy<'a>,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<'a, T> Clone for Cow<'a, T>
where T: ?Sized + Dairy<'a>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T> Debug for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Debug, T::Owned: Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, T> Default for Cow<'a, T>
where T: ?Sized + Dairy<'a>, T::Owned: Default,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'a, T> Deref for Cow<'a, T>
where T: ?Sized + Dairy<'a>,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
Source§

impl<'a, T> Display for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Display, T::Owned: Display,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b> Extend<&'b OsStr> for Cow<'a, OsStr>

Source§

fn extend<I: IntoIterator<Item = &'b OsStr>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b OsString> for Cow<'a, OsStr>

Source§

fn extend<I: IntoIterator<Item = &'b OsString>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b Path> for Cow<'a, Path>

Source§

fn extend<I: IntoIterator<Item = &'b Path>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b PathBuf> for Cow<'a, Path>

Source§

fn extend<I: IntoIterator<Item = &'b PathBuf>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b String> for Cow<'a, str>

Source§

fn extend<I: IntoIterator<Item = &'b String>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b, T: 'a + 'b + Copy> Extend<&'b T> for Cow<'a, [T]>

Source§

fn extend<I: IntoIterator<Item = &'b T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b char> for Cow<'a, str>

Source§

fn extend<I: IntoIterator<Item = &'b char>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<&'b str> for Cow<'a, str>

Source§

fn extend<I: IntoIterator<Item = &'b str>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<Box<OsStr>> for Cow<'_, OsStr>

Source§

fn extend<I: IntoIterator<Item = Box<OsStr>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<Box<Path>> for Cow<'_, Path>

Source§

fn extend<I: IntoIterator<Item = Box<Path>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<Box<str>> for Cow<'_, str>

Source§

fn extend<I: IntoIterator<Item = Box<str>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<Cow<'b, OsStr>> for Cow<'a, OsStr>

Source§

fn extend<I: IntoIterator<Item = Cow<'b, OsStr>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<Cow<'b, Path>> for Cow<'a, Path>

Source§

fn extend<I: IntoIterator<Item = Cow<'b, Path>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b> Extend<Cow<'b, str>> for Cow<'a, str>

Source§

fn extend<I: IntoIterator<Item = Cow<'b, str>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<OsString> for Cow<'_, OsStr>

Source§

fn extend<I: IntoIterator<Item = OsString>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<PathBuf> for Cow<'_, Path>

Source§

fn extend<I: IntoIterator<Item = PathBuf>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<String> for Cow<'_, str>

Source§

fn extend<I: IntoIterator<Item = String>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, 'b, T: 'a + Clone> Extend<T> for Cow<'a, [T]>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl Extend<char> for Cow<'_, str>

Source§

fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'a, T: 'a + Clone> From<&'a [T]> for Cow<'a, [T]>

Source§

fn from(v: &'a [T]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a CStr> for Cow<'a, CStr>

Source§

fn from(s: &'a CStr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a CString> for Cow<'a, CStr>

Source§

fn from(s: &'a CString) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsStr> for Cow<'a, OsStr>

Source§

fn from(s: &'a OsStr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsStr> for Cow<'a, Path>

Source§

fn from(p: &'a OsStr) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsString> for Cow<'a, OsStr>

Source§

fn from(s: &'a OsString) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a OsString> for Cow<'a, Path>

Source§

fn from(p: &'a OsString) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Path> for Cow<'a, OsStr>

Source§

fn from(s: &'a Path) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Path> for Cow<'a, Path>

Source§

fn from(p: &'a Path) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PathBuf> for Cow<'a, OsStr>

Source§

fn from(s: &'a PathBuf) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PathBuf> for Cow<'a, Path>

Source§

fn from(p: &'a PathBuf) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a String> for Cow<'a, OsStr>

Source§

fn from(s: &'a String) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a String> for Cow<'a, Path>

Source§

fn from(p: &'a String) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a String> for Cow<'a, str>

Source§

fn from(s: &'a String) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone> From<&'a Vec<T>> for Cow<'a, [T]>

Source§

fn from(v: &'a Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Cow<'a, OsStr>

Source§

fn from(p: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Cow<'a, Path>

Source§

fn from(p: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for Cow<'a, str>

Source§

fn from(s: &'a str) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone, const N: usize> From<[T; N]> for Cow<'a, [T]>

Source§

fn from(v: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone> From<Box<[T]>> for Cow<'a, [T]>

Source§

fn from(v: Box<[T]>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<CStr>> for Cow<'_, CStr>

Source§

fn from(s: Box<CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<OsStr>> for Cow<'_, OsStr>

Source§

fn from(s: Box<OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<OsStr>> for Cow<'_, Path>

Source§

fn from(p: Box<OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<Path>> for Cow<'_, OsStr>

Source§

fn from(s: Box<Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<Path>> for Cow<'_, Path>

Source§

fn from(p: Box<Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<str>> for Cow<'_, OsStr>

Source§

fn from(s: Box<str>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<str>> for Cow<'_, Path>

Source§

fn from(p: Box<str>) -> Self

Converts to this type from the input type.
Source§

impl From<Box<str>> for Cow<'_, str>

Source§

fn from(s: Box<str>) -> Self

Converts to this type from the input type.
Source§

impl From<CString> for Cow<'_, CStr>

Source§

fn from(s: CString) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, CStr>> for Box<CStr>

Source§

fn from(s: Cow<'_, CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, CStr>> for CString

Source§

fn from(s: Cow<'_, CStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, OsStr>> for Box<OsStr>

Source§

fn from(s: Cow<'_, OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, OsStr>> for OsString

Source§

fn from(s: Cow<'_, OsStr>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, Path>> for Box<Path>

Source§

fn from(p: Cow<'_, Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, Path>> for PathBuf

Source§

fn from(p: Cow<'_, Path>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, str>> for Box<str>

Source§

fn from(s: Cow<'_, str>) -> Self

Converts to this type from the input type.
Source§

impl From<Cow<'_, str>> for String

Source§

fn from(s: Cow<'_, str>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone> From<Cow<'a, [T]>> for Box<[T]>

Source§

fn from(v: Cow<'a, [T]>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone> From<Cow<'a, [T]>> for Vec<T>

Source§

fn from(v: Cow<'a, [T]>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<Cow<'a, T>> for Cow<'a, T>
where T: Dairy<'a>,

Source§

fn from(c: StdCow<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl From<OsString> for Cow<'_, OsStr>

Source§

fn from(s: OsString) -> Self

Converts to this type from the input type.
Source§

impl From<OsString> for Cow<'_, Path>

Source§

fn from(p: OsString) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for Cow<'_, Path>

Source§

fn from(p: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<PathBuf> for Cow<'a, OsStr>

Source§

fn from(s: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Cow<'_, OsStr>

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Cow<'_, Path>

Source§

fn from(p: String) -> Self

Converts to this type from the input type.
Source§

impl From<String> for Cow<'_, str>

Source§

fn from(s: String) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Clone> From<Vec<T>> for Cow<'a, [T]>

Source§

fn from(v: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Cow<'_, OsStr>

Source§

fn from(c: char) -> Self

Converts to this type from the input type.
Source§

impl From<char> for Cow<'_, str>

Source§

fn from(c: char) -> Self

Converts to this type from the input type.
Source§

impl<'a, 'b> FromIterator<&'b OsStr> for Cow<'a, OsStr>

Source§

fn from_iter<I: IntoIterator<Item = &'b OsStr>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b OsString> for Cow<'a, OsStr>

Source§

fn from_iter<I: IntoIterator<Item = &'b OsString>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b Path> for Cow<'a, Path>

Source§

fn from_iter<I: IntoIterator<Item = &'b Path>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b PathBuf> for Cow<'a, Path>

Source§

fn from_iter<I: IntoIterator<Item = &'b PathBuf>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b String> for Cow<'a, str>

Source§

fn from_iter<I: IntoIterator<Item = &'b String>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b, T: 'a + 'b + Copy> FromIterator<&'b T> for Cow<'a, [T]>

Source§

fn from_iter<I: IntoIterator<Item = &'b T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b char> for Cow<'a, str>

Source§

fn from_iter<I: IntoIterator<Item = &'b char>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b> FromIterator<&'b str> for Cow<'a, str>

Source§

fn from_iter<I: IntoIterator<Item = &'b str>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Box<OsStr>> for Cow<'_, OsStr>

Source§

fn from_iter<I: IntoIterator<Item = Box<OsStr>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Box<Path>> for Cow<'_, Path>

Source§

fn from_iter<I: IntoIterator<Item = Box<Path>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<Box<str>> for Cow<'_, str>

Source§

fn from_iter<I: IntoIterator<Item = Box<str>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> FromIterator<Cow<'a, OsStr>> for Cow<'a, OsStr>

Source§

fn from_iter<I: IntoIterator<Item = Cow<'a, OsStr>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> FromIterator<Cow<'a, Path>> for Cow<'a, Path>

Source§

fn from_iter<I: IntoIterator<Item = Cow<'a, Path>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> FromIterator<Cow<'a, str>> for Cow<'a, str>

Source§

fn from_iter<I: IntoIterator<Item = Cow<'a, str>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<OsString> for Cow<'_, OsStr>

Source§

fn from_iter<I: IntoIterator<Item = OsString>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<PathBuf> for Cow<'_, Path>

Source§

fn from_iter<I: IntoIterator<Item = PathBuf>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<String> for Cow<'_, str>

Source§

fn from_iter<I: IntoIterator<Item = String>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, 'b, T: 'a + Clone> FromIterator<T> for Cow<'a, [T]>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl FromIterator<char> for Cow<'_, str>

Source§

fn from_iter<I: IntoIterator<Item = char>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a> FromStr for Cow<'a, OsStr>

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> FromStr for Cow<'a, Path>

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a> FromStr for Cow<'a, str>

Source§

type Err = Infallible

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<'a, T> Hash for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Hash,

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a, T> Ord for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Ord,

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U> PartialEq<&[U]> for Cow<'a, [T]>

Source§

fn eq(&self, other: &&[U]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U, const N: usize> PartialEq<&[U; N]> for Cow<'a, [T]>

Source§

fn eq(&self, other: &&[U; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&CStr> for Cow<'a, CStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&CString> for Cow<'a, CStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsStr> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsStr> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsStr> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsString> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsString> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&OsString> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&Path> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&Path> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&PathBuf> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&PathBuf> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&String> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U> PartialEq<&Vec<U>> for Cow<'a, [T]>

Source§

fn eq(&self, other: &&Vec<U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<&str> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U> PartialEq<[U]> for Cow<'a, [T]>

Source§

fn eq(&self, other: &[U]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U, const N: usize> PartialEq<[U; N]> for Cow<'a, [T]>

Source§

fn eq(&self, other: &[U; N]) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<CStr> for Cow<'a, CStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<CString> for Cow<'a, CStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, 'b, T, U> PartialEq<Cow<'b, U>> for Cow<'a, T>
where T: ?Sized + Dairy<'a> + PartialEq<U>, U: ?Sized + Dairy<'b>,

Source§

fn eq(&self, other: &Cow<'b, U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsStr> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsStr> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsStr> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsString> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsString> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<OsString> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Path> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<Path> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<PathBuf> for Cow<'a, OsStr>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<PathBuf> for Cow<'a, Path>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<String> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T: 'a + Clone + PartialEq<U>, U> PartialEq<Vec<U>> for Cow<'a, [T]>

Source§

fn eq(&self, other: &Vec<U>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> PartialEq<str> for Cow<'a, str>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T> PartialOrd for Cow<'a, T>
where T: ?Sized + Dairy<'a> + PartialOrd,

Source§

fn partial_cmp(&self, other: &Cow<'a, T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, T> Eq for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Eq,

Source§

impl<'a, T> Send for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Sync, T::Owned: Send,

Source§

impl<'a, T> Sync for Cow<'a, T>
where T: ?Sized + Dairy<'a> + Sync, T::Owned: Sync,

Source§

impl<'a, T> Unpin for Cow<'a, T>
where T: ?Sized + Dairy<'a>, T::Owned: Unpin,

Auto Trait Implementations§

§

impl<'a, T> Freeze for Cow<'a, T>
where <T as Dairy<'a>>::Cow: Freeze, T: ?Sized,

§

impl<'a, T> RefUnwindSafe for Cow<'a, T>
where <T as Dairy<'a>>::Cow: RefUnwindSafe, T: ?Sized,

§

impl<'a, T> UnwindSafe for Cow<'a, T>
where <T as Dairy<'a>>::Cow: UnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.