A crate wich add a derive TryClone macro for the TryClone Trait of the fallible_allocation crate
This is my first proc macro, the code is very dummy and works only on the simplest cases, without Generic types, etc But contributions are welcome !
try clone derive is available on crates.io. It is recommended to look there for the newest released version, as well as links to the newest builds of the docs.
At the point of the last update of this README, the latest published version could be used like this:
Add the following dependency to your Cargo manifest...
toml
[dependencies]
try_clone_derive = "0.1.1"
...and see the docs for how to use it.
```rust use fallible_collections::TryClone;
use tryclonederive::TryClone;
pub struct MyStruct{
a: u32,
b: Vec
fn main() { // this crate an Ordinary box but return an error on allocation failure let mystruct = MyStruct { a: 42, b: vec![42; 42], c: Arc::new(42), }; asserteq!(mystruct.tryclone().unwrap(), my_struct); } ```
Licensed under either of
at your option.
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.