#[repr(C)]pub struct AllocPrefix<Alloc> {
pub strong: AtomicUsize,
pub weak: AtomicUsize,
pub capacity: AtomicUsize,
pub origin: NonNull<()>,
pub alloc: MaybeUninit<Alloc>,
}Expand description
The prefix common to all allocations in stabby::alloc.
This allows reuse of allocations when converting between container types.
Fields§
§strong: AtomicUsizeThe strong count for reference counted types.
weak: AtomicUsizeThe weak count for reference counted types.
capacity: AtomicUsizeA slot to store a vector’s capacity when it’s turned into a boxed/arced slice.
origin: NonNull<()>The origin of the prefix
alloc: MaybeUninit<Alloc>A slot for the allocator.
Implementations§
Source§impl<Alloc> AllocPrefix<Alloc>where
Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>>: IStable,
MaybeUninit<Alloc>: IStable,
NonNull<()>: IStable,
AtomicUsize: IStable,
impl<Alloc> AllocPrefix<Alloc>where
Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>>: IStable,
MaybeUninit<Alloc>: IStable,
NonNull<()>: IStable,
AtomicUsize: IStable,
Sourcepub const fn has_optimal_layout() -> bool
pub const fn has_optimal_layout() -> bool
Returns true if the layout for AllocPrefix is smaller or equal to that Rust would have generated for it.
Trait Implementations§
Source§impl<Alloc> IStable for AllocPrefix<Alloc>where
Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>>: IStable,
MaybeUninit<Alloc>: IStable,
NonNull<()>: IStable,
AtomicUsize: IStable,
impl<Alloc> IStable for AllocPrefix<Alloc>where
Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>>: IStable,
MaybeUninit<Alloc>: IStable,
NonNull<()>: IStable,
AtomicUsize: IStable,
Source§const REPORT: &'static TypeReport
const REPORT: &'static TypeReport
A compile-time generated report of the fields of the type, allowing for compatibility inspection.
Source§const ID: u64
const ID: u64
A stable (and ideally unique) identifier for the type. Often generated using
crate::report::gen_id, but can be manually set.Source§type ForbiddenValues = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::ForbiddenValues
type ForbiddenValues = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::ForbiddenValues
The values that the annotated type cannot occupy.
Source§type UnusedBits = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::UnusedBits
type UnusedBits = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::UnusedBits
The padding bits in the annotated types
Source§type Size = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::Size
type Size = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::Size
The size of the annotated type in bytes.
Source§type Align = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::Align
type Align = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::Align
The alignment of the annotated type in bytes.
Source§type HasExactlyOneNiche = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::HasExactlyOneNiche
type HasExactlyOneNiche = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::HasExactlyOneNiche
Allows the detection of whether or not
core::option::Options are stable: Read moreSource§type ContainsIndirections = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::ContainsIndirections
type ContainsIndirections = <Struct<FieldPair<FieldPair<FieldPair<FieldPair<AtomicUsize, AtomicUsize>, AtomicUsize>, NonNull<()>>, MaybeUninit<Alloc>>> as IStable>::ContainsIndirections
Whether or not the type contains indirections (pointers, indices in independent data-structures…)
Auto Trait Implementations§
impl<Alloc> !Freeze for AllocPrefix<Alloc>
impl<Alloc> RefUnwindSafe for AllocPrefix<Alloc>where
Alloc: RefUnwindSafe,
impl<Alloc> !Send for AllocPrefix<Alloc>
impl<Alloc> !Sync for AllocPrefix<Alloc>
impl<Alloc> Unpin for AllocPrefix<Alloc>where
Alloc: Unpin,
impl<Alloc> UnwindSafe for AllocPrefix<Alloc>where
Alloc: UnwindSafe,
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more