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. The type is designed to
work with general borrowed data via the Borrow trait.
Cow implements Deref, which means that you can call
non-mutating methods directly on the data it encloses. If mutation
is desired, to_mut will obtain a mutable reference to an owned
value, cloning if necessary.
If you need reference-counting pointers, note that
Rc::make_mut and
Arc::make_mut can provide clone-on-write
functionality as well.
use std::borrow::Cow;
fn abs_all(input: &mut Cow<[i32]>) {
for i in 0..input.len() {
let v = input[i];
if v < 0 {
input.to_mut()[i] = -v;
}
}
}
let slice = [0, 1, 2];
let mut input = Cow::from(&slice[..]);
abs_all(&mut input);
let slice = [-1, 0, 1];
let mut input = Cow::from(&slice[..]);
abs_all(&mut input);
let mut input = Cow::from(vec![-1, 0, 1]);
abs_all(&mut input);
Another example showing how to keep Cow in a struct:
use std::borrow::Cow;
struct Items<'a, X: 'a> where [X]: ToOwned<Owned = Vec<X>> {
values: Cow<'a, [X]>,
}
impl<'a, X: Clone + 'a> Items<'a, X> where [X]: ToOwned<Owned = Vec<X>> {
fn new(v: Cow<'a, [X]>) -> Self {
Items { values: v }
}
}
let readonly = [1, 2];
let borrowed = Items::new((&readonly[..]).into());
match borrowed {
Items { values: Cow::Borrowed(b) } => println!("borrowed {:?}", b),
_ => panic!("expect borrowed value"),
}
let mut clone_on_write = borrowed;
clone_on_write.values.to_mut().push(3);
println!("clone_on_write = {:?}", clone_on_write.values);
match clone_on_write {
Items { values: Cow::Owned(_) } => println!("clone_on_write contains owned data"),
_ => panic!("expect owned data"),
}
🔬 This is a nightly-only experimental API. (cow_is_borrowed)
Returns true if the data is borrowed, i.e. if to_mut would require additional work.
#![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());
🔬 This is a nightly-only experimental API. (cow_is_borrowed)
Returns true if the data is owned, i.e. if to_mut would be a no-op.
#![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());
Acquires a mutable reference to the owned form of the data.
Clones the data if it is not already owned.
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>
);
Extracts the owned data.
Clones the data if it is not already owned.
Calling into_owned on a Cow::Borrowed clones the underlying data
and becomes a Cow::Owned:
use std::borrow::Cow;
let s = "Hello world!";
let cow = Cow::Borrowed(s);
assert_eq!(
cow.into_owned(),
String::from(s)
);
Calling into_owned on a Cow::Owned is a no-op:
use std::borrow::Cow;
let s = "Hello world!";
let cow: Cow<str> = Cow::Owned(String::from(s));
assert_eq!(
cow.into_owned(),
String::from(s)
);
The resulting type after applying the + operator.
The resulting type after applying the + operator.
Immutably borrows from an owned value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Creates an owned Cow<’a, B> with the default value for the contained owned value.
The resulting type after dereferencing.
Deserialize this value from the given Serde deserializer. Read more
Formats the value using the given formatter. Read more
Converts a String reference into a Borrowed variant.
No heap allocation is performed, and the string
is not copied.
let s = "eggplant".to_string();
assert_eq!(Cow::from(&s), Cow::Borrowed("eggplant"));
Converts a string slice into a Borrowed variant.
No heap allocation is performed, and the string
is not copied.
assert_eq!(Cow::from("eggplant"), Cow::Borrowed("eggplant"));
Convert a clone-on-write slice into a vector.
If s already owns a Vec<T>, it will be returned directly.
If s is borrowing a slice, a new Vec<T> will be allocated and
filled by cloning s’s items into it.
let o: Cow<[i32]> = Cow::Owned(vec![1, 2, 3]);
let b: Cow<[i32]> = Cow::Borrowed(&[1, 2, 3]);
assert_eq!(Vec::from(o), Vec::from(b));
impl<'value> From<Cow<'value, str>> for Value<'value>[src]
impl<'value> From<Cow<'value, str>> for Value[src]
impl<'a> From<OsString> for Cow<'a, OsStr>1.28.0[src]
impl<'a> From<PathBuf> for Cow<'a, Path>1.6.0[src]
impl<'a> From<String> for Cow<'a, str>[src]
pub fn from(s: String) -> Cow<'a, str>[src]
Converts a String into an Owned variant.
No heap allocation is performed, and the string
is not copied.
let s = "eggplant".to_string();
let s2 = "eggplant".to_string();
assert_eq!(Cow::from(s), Cow::<'static, str>::Owned(s2));
impl<'a, T> From<Vec<T, Global>> for Cow<'a, [T]> where
T: Clone, 1.8.0[src]
impl<'a, 'b> FromIterator<&'b str> for Cow<'a, str>1.12.0[src]
impl<'a> FromIterator<String> for Cow<'a, str>1.12.0[src]
impl<'a, T> FromIterator<T> for Cow<'a, [T]> where
T: Clone, [src]
impl<'a> FromIterator<char> for Cow<'a, str>1.12.0[src]
impl<'_, B> Hash for Cow<'_, B> where
B: Hash + ToOwned + ?Sized, [src]
impl<'de, 'a, E> IntoDeserializer<'de, E> for Cow<'a, str> where
E: Error, [src]
impl<'_, B> Ord for Cow<'_, B> where
B: Ord + ToOwned + ?Sized, [src]
pub fn cmp(&self, other: &Cow<'_, B>) -> Ordering[src]
#[must_use]
pub fn max(self, other: Self) -> Self1.21.0[src]
Compares and returns the maximum of two values. Read more
#[must_use]
pub fn min(self, other: Self) -> Self1.21.0[src]
Compares and returns the minimum of two values. Read more
#[must_use]
pub fn clamp(self, min: Self, max: Self) -> Self1.50.0[src]
Restrict a value to a certain interval. Read more
impl<'_, '_, T, U> PartialEq<&'_ [U]> for Cow<'_, [T]> where
T: PartialEq<U> + Clone, [src]
pub fn eq(&self, other: &&[U]) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &&[U]) -> bool[src]
This method tests for !=.
impl<'_, '_, T, U> PartialEq<&'_ mut [U]> for Cow<'_, [T]> where
T: PartialEq<U> + Clone, [src]
impl<'a, 'b> PartialEq<&'a Path> for Cow<'b, OsStr>1.8.0[src]
pub fn eq(&self, other: &&'a Path) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<&'b OsStr> for Cow<'a, Path>1.8.0[src]
pub fn eq(&self, other: &&'b OsStr) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<&'b OsStr> for Cow<'a, OsStr>1.8.0[src]
pub fn eq(&self, other: &&'b OsStr) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<&'b Path> for Cow<'a, Path>1.6.0[src]
pub fn eq(&self, other: &&'b Path) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<&'b str> for Cow<'a, str>[src]
pub fn eq(&self, other: &&'b str) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &&'b str) -> bool[src]
This method tests for !=.
impl<'a, 'b, B, C> PartialEq<Cow<'b, C>> for Cow<'a, B> where
C: ToOwned + ?Sized,
B: PartialEq<C> + ToOwned + ?Sized, [src]
pub fn eq(&self, other: &Cow<'b, C>) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<OsStr> for Cow<'a, OsStr>1.8.0[src]
pub fn eq(&self, other: &OsStr) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<OsStr> for Cow<'a, Path>1.8.0[src]
pub fn eq(&self, other: &OsStr) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<OsString> for Cow<'a, Path>1.8.0[src]
pub fn eq(&self, other: &OsString) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<OsString> for Cow<'a, OsStr>1.8.0[src]
pub fn eq(&self, other: &OsString) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<Path> for Cow<'a, Path>1.6.0[src]
pub fn eq(&self, other: &Path) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<Path> for Cow<'a, OsStr>1.8.0[src]
pub fn eq(&self, other: &Path) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, Path>1.6.0[src]
pub fn eq(&self, other: &PathBuf) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<PathBuf> for Cow<'a, OsStr>1.8.0[src]
pub fn eq(&self, other: &PathBuf) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
#[must_use]
pub fn ne(&self, other: &Rhs) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<String> for Cow<'a, str>[src]
impl<'_, T, U, A> PartialEq<Vec<U, A>> for Cow<'_, [T]> where
T: PartialEq<U> + Clone,
A: Allocator, [src]
pub fn eq(&self, other: &Vec<U, A>) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &Vec<U, A>) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialEq<str> for Cow<'a, str>[src]
pub fn eq(&self, other: &str) -> bool[src]
This method tests for self and other values to be equal, and is used
by ==. Read more
pub fn ne(&self, other: &str) -> bool[src]
This method tests for !=.
impl<'a, 'b> PartialOrd<&'a Path> for Cow<'b, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &&'a Path) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<&'b OsStr> for Cow<'a, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &&'b OsStr) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<&'b OsStr> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &&'b OsStr) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<&'b Path> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &&'b Path) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, B> PartialOrd<Cow<'a, B>> for Cow<'a, B> where
B: PartialOrd<B> + ToOwned + ?Sized, [src]
pub fn partial_cmp(&self, other: &Cow<'a, B>) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<OsStr> for Cow<'a, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &OsStr) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<OsStr> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &OsStr) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<OsString> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &OsString) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<OsString> for Cow<'a, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &OsString) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<Path> for Cow<'a, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &Path) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<Path> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &Path) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<PathBuf> for Cow<'a, OsStr>1.8.0[src]
pub fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, 'b> PartialOrd<PathBuf> for Cow<'a, Path>1.8.0[src]
pub fn partial_cmp(&self, other: &PathBuf) -> Option<Ordering>[src]
This method returns an ordering between self and other values if one exists. Read more
#[must_use]
pub fn lt(&self, other: &Rhs) -> bool[src]
This method tests less than (for self and other) and is used by the < operator. Read more
#[must_use]
pub fn le(&self, other: &Rhs) -> bool[src]
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
#[must_use]
pub fn gt(&self, other: &Rhs) -> bool[src]
This method tests greater than (for self and other) and is used by the > operator. Read more
#[must_use]
pub fn ge(&self, other: &Rhs) -> bool[src]
This method tests greater than or equal to (for self and other) and is used by the >=
operator. Read more
impl<'a, T> Serialize for Cow<'a, T> where
T: Serialize + ToOwned + ?Sized, [src]
impl<'_> ToString for Cow<'_, str>1.17.0[src]
impl<'a, B: ?Sized> RefUnwindSafe for Cow<'a, B> where
B: RefUnwindSafe,
<B as ToOwned>::Owned: RefUnwindSafe,
impl<'a, B: ?Sized> Send for Cow<'a, B> where
B: Sync,
<B as ToOwned>::Owned: Send,
impl<'a, B: ?Sized> Sync for Cow<'a, B> where
B: Sync,
<B as ToOwned>::Owned: Sync,
impl<'a, B: ?Sized> Unpin for Cow<'a, B> where
<B as ToOwned>::Owned: Unpin,
impl<'a, B: ?Sized> UnwindSafe for Cow<'a, B> where
B: RefUnwindSafe,
<B as ToOwned>::Owned: UnwindSafe,
impl<T> Any for T where
T: 'static + ?Sized, [src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
impl<T> ToOwned for T where
T: Clone, [src]
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> ToString for T where
T: Display + ?Sized, [src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]