Address comments
This commit is contained in:
parent
453e919c37
commit
6d99dd9189
6 changed files with 19 additions and 25 deletions
|
@ -3,6 +3,8 @@ use std::mem::{size_of, transmute_copy, MaybeUninit};
|
|||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Erased<T: Copy> {
|
||||
// We use `MaybeUninit` here so we can store any value
|
||||
// in `data` since we aren't actually storing a `T`.
|
||||
data: MaybeUninit<T>,
|
||||
}
|
||||
|
||||
|
@ -12,7 +14,7 @@ pub trait EraseType: Copy {
|
|||
|
||||
// Allow `type_alias_bounds` since compilation will fail without `EraseType`.
|
||||
#[allow(type_alias_bounds)]
|
||||
pub type Erase<T: Copy + EraseType> = Erased<impl Copy>;
|
||||
pub type Erase<T: EraseType> = Erased<impl Copy>;
|
||||
|
||||
#[inline(always)]
|
||||
pub fn erase<T: EraseType>(src: T) -> Erase<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue