-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed Clone trait and introduced TryClone trait
- Loading branch information
Showing
4 changed files
with
38 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "alloc-checked" | ||
description = "Collections that don't panic on alloc failures" | ||
authors = ["Adam Cimarosti <[email protected]>"] | ||
version = "0.1.0" | ||
version = "0.1.1" | ||
edition = "2021" | ||
repository = "https://github.com/questdb/alloc-checked" | ||
keywords = ["alloc", "collections", "no-std", "safe-allocation", "container"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
extern crate alloc; | ||
extern crate core; | ||
|
||
pub mod try_clone; | ||
pub mod vec; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// A variant of the `Clone` trait which can fail. | ||
pub trait TryClone: Sized { | ||
type Error; | ||
|
||
fn try_clone(&self) -> Result<Self, Self::Error>; | ||
fn try_clone_from(&mut self, source: &Self) -> Result<(), Self::Error> { | ||
*self = source.try_clone()?; | ||
Ok(()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters