musli_core/alloc/
to_owned.rs

1use core::borrow::Borrow;
2
3use crate::alloc::{Allocator, String, Vec};
4
5/// The local `ToOwned`` implementation for Musli's allocation system.
6pub trait ToOwned {
7    /// The owned value.
8    type Owned<A>: Borrow<Self>
9    where
10        A: Allocator;
11}
12
13impl<T> ToOwned for [T] {
14    type Owned<A>
15        = Vec<T, A>
16    where
17        A: Allocator;
18}
19
20impl ToOwned for str {
21    type Owned<A>
22        = String<A>
23    where
24        A: Allocator;
25}