https://github.com/openbytedev/try-clone
Fallible cloning.
https://github.com/openbytedev/try-clone
Last synced: 4 months ago
JSON representation
Fallible cloning.
- Host: GitHub
- URL: https://github.com/openbytedev/try-clone
- Owner: OpenByteDev
- License: mit
- Created: 2025-12-28T20:37:21.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-12-28T21:00:32.000Z (4 months ago)
- Last Synced: 2025-12-31T12:56:15.115Z (4 months ago)
- Language: Rust
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# try-clone
[](https://github.com/OpenByteDev/try-clone/actions/workflows/ci.yml) [](https://crates.io/crates/try-clone) [](https://docs.rs/try-clone) [](https://deps.rs/repo/github/openbytedev/try-clone) [](https://github.com/OpenByteDev/try-clone/blob/master/LICENSE)
Fallible cloning.
This crate defines [`TryClone`](https://docs.rs/try-clone/latest/try_clone/trait.TryClone.html), a small trait for types whose cloning operation can fail. Unlike [`Clone`](https://doc.rust-lang.org/std/clone/trait.Clone.html), which is infallible by design, [`TryClone`](https://docs.rs/try-clone/latest/try_clone/trait.TryClone.html) returns a [`Result`](https://doc.rust-lang.org/std/result/enum.Result.html) to allow implementations to report errors.
Implementations are provided for standard library types that expose a [`try_clone`](https://doc.rust-lang.org/stable/std/clone/index.html?search=try_clone) API, such as [`File`](https://doc.rust-lang.org/std/fs/struct.File.html), as well as for common containers and collections ([`Box`](https://doc.rust-lang.org/std/boxed/struct.Box.html), [`Arc`](https://doc.rust-lang.org/std/sync/struct.Arc.html), [`Vec`](https://doc.rust-lang.org/std/vec/struct.Vec.html), ...) where appropriate APIs exists.
A blanket implementation is available behind the `blanket-impl` feature, which implements [`TryClone`](https://docs.rs/try-clone/latest/try_clone/trait.TryClone.html) for all [`Clone`](https://doc.rust-lang.org/std/clone/trait.Clone.html) types.
## License
Licensed under the MIT license ([LICENSE](https://github.com/OpenByteDev/try-clone/blob/master/LICENSE) or http://opensource.org/licenses/MIT)