#generic #owned #reference #cow

no-std into-owned

Provides a trait for associating a type with its owned variant

4 releases (2 breaking)

0.3.0-alpha.2 May 24, 2020
0.3.0-alpha May 10, 2020
0.2.2 May 9, 2020
0.1.0 May 4, 2020

#1141 in Rust patterns

32 downloads per month

MIT/Apache

35KB
766 lines

crates.io docs.rs

IntoOwned

Provides a trait IntoOwned and three enums Is<'a, T>, Gyu<'a, T>, and GyuMut<'a, T>.

IntoOwned associates a type with its owned variant. In this experimental version, IntoOwned is implemented only for primitive numeric types (i8, i16, i32, i64, i128, isize, u8, u16, u32, u64, u128, usize, f32, and f64) and their references.

Is<'a, T>, Gyu<'a, T>, and GyuMut<'a, T> are clone-on-write smart pointers similar to Cow<'a, B>. These can be constructed from a type which is IntoOwned. See documentation for more.

no_std

To use into-owned without the standard library, disable the default std feature in Cargo.toml:

[dependencies]
into-owned = { version = "0.3.0-alpha.2", default-features = false }

In this version, only IntoOwned::into_cow method requires the standard library.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps

Features

  • std