dyn-clonable-0.9.2/.cargo_vcs_info.json0000644000000001520000000000100134110ustar { "git": { "sha1": "7ec332d7915c226bc59a4e5979e0490422874a89" }, "path_in_vcs": "dyn-clonable" }dyn-clonable-0.9.2/.gitignore000064400000000000000000000000361046102023000141720ustar 00000000000000/target **/*.rs.bk Cargo.lock dyn-clonable-0.9.2/Cargo.lock0000644000000030350000000000100113670ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 3 [[package]] name = "dyn-clonable" version = "0.9.2" dependencies = [ "dyn-clonable-impl", "dyn-clone", ] [[package]] name = "dyn-clonable-impl" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e8671d54058979a37a26f3511fbf8d198ba1aa35ffb202c42587d918d77213a" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "dyn-clone" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3ec9c7fb9a2ce708751c98e31ccbae74b6ab194f5c8e30cfb7ed62e38b70866" [[package]] name = "proc-macro2" version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] [[package]] name = "syn" version = "2.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5d0adab1ae378d7f53bdebc67a39f1f151407ef230f0ce2883572f5d8985c80" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "unicode-ident" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11cd88e12b17c6494200a9c1b683a04fcac9573ed74cd1b62aeb2727c5592243" dyn-clonable-0.9.2/Cargo.toml0000644000000017630000000000100114200ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2018" name = "dyn-clonable" version = "0.9.2" authors = ["Jacob Brown "] build = false autobins = false autoexamples = false autotests = false autobenches = false description = "Attribute wrapper for dyn-clone" readme = "README.md" license = "MIT" repository = "https://github.com/kardeiz/objekt-clonable" [lib] name = "dyn_clonable" path = "src/lib.rs" [[example]] name = "simple" path = "examples/simple.rs" [dependencies.dyn-clonable-impl] version = "0.9" [dependencies.dyn-clone] version = "1.0" dyn-clonable-0.9.2/Cargo.toml.orig000064400000000000000000000005651046102023000151000ustar 00000000000000[package] authors = ["Jacob Brown "] edition = "2018" name = "dyn-clonable" version = "0.9.2" description = "Attribute wrapper for dyn-clone" license = "MIT" repository = "https://github.com/kardeiz/objekt-clonable" readme = "../README.md" [dependencies] dyn-clone = "1.0" [dependencies.dyn-clonable-impl] path = "../dyn-clonable-impl" version = "0.9" dyn-clonable-0.9.2/README.md000064400000000000000000000005441046102023000134650ustar 00000000000000# dyn-clonable Provides a proc_macro attribute wrapper for [dyn-clone](https://docs.rs/dyn-clone/*/dyn_clone/). # Usage ```rust use dyn_clonable::*; #[clonable] trait MyTrait: Clone { fn recite(&self); } ``` For additional information, see [dtolnay's](https://github.com/dtolnay) [dyn-clone](https://docs.rs/dyn-clone/*/dyn_clone/). License: MIT dyn-clonable-0.9.2/examples/simple.rs000064400000000000000000000014541046102023000156640ustar 00000000000000use dyn_clonable::*; use std::io::Read; #[clonable] trait Difficult: Clone where R: Read { /* ... */ } #[clonable] trait MyTrait: Clone { fn recite(&self); } #[clonable] trait MyTrait2: std::clone::Clone { fn recite2(&self); } impl MyTrait for String { fn recite(&self) { println!("{} ♫", self); } } #[derive(Clone)] struct Container { trait_object: Box } fn main() { let line = "The slithy structs did gyre and gimble the namespace"; // Build a trait object holding a String. // This requires String to implement MyTrait and std::clone::Clone. let x: Box = Box::new(String::from(line)); x.recite(); // The type of x2 is a Box cloned from x. let x2 = dyn_clone::clone_box(&*x); x2.recite(); } dyn-clonable-0.9.2/src/lib.rs000064400000000000000000000001431046102023000141040ustar 00000000000000#[doc(hidden)] pub use dyn_clone; // Re-export the attribute macro. pub use dyn_clonable_impl::*;