Skip to content

Commit

Permalink
fixed off code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
amunra committed Oct 10, 2024
1 parent febdc88 commit f4be960
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
32 changes: 15 additions & 17 deletions src/claim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,21 @@ pub trait Claim: Clone {}

// Anything which is trivially copiable is automatically infallible
// We need to list these out since the compiler will not allow us to `impl <T: Copy> impl Claim {}`
impl Claim for () {}
impl Claim for u8 {}
impl Claim for u16 {}
impl Claim for u32 {}
impl Claim for u64 {}
impl Claim for u128 {}
impl Claim for usize {}
impl Claim for i8 {}
impl Claim for i16 {}
impl Claim for i32 {}
impl Claim for i64 {}
impl Claim for i128 {}
impl Claim for isize {}
impl Claim for f32 {}
impl Claim for f64 {}
impl Claim for bool {}
impl Claim for char {}
macro_rules! impl_claim_for {
($($t:ty),*) => {
$(
impl Claim for $t {}
)*
};
}

// Generate impls for simple types
impl_claim_for! {
(), u8, u16, u32, u64, u128, usize,
i8, i16, i32, i64, i128, isize,
f32, f64, bool, char
}

impl<T: ?Sized> Claim for *const T {}
impl<T: ?Sized> Claim for *mut T {}
impl<T: Copy, const N: usize> Claim for [T; N] {}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
extern crate alloc;
extern crate core;

mod claim;
pub mod claim;
pub mod try_clone;
pub mod vec;

0 comments on commit f4be960

Please sign in to comment.