pub trait PtrProps<T: ?Sized> {
// Required methods
unsafe fn sz(&self) -> usize;
unsafe fn aln(&self) -> usize;
// Provided methods
unsafe fn layout(&self) -> Layout { ... }
unsafe fn is_zst(&self) -> bool { ... }
unsafe fn max_slice_len(&self) -> usize { ... }
}Expand description
A trait providing methods for pointers to provide the properties of their pointees.
Required Methods§
Provided Methods§
Sourceunsafe fn layout(&self) -> Layout
unsafe fn layout(&self) -> Layout
Gets the memory layout for the value.
§Safety
Callers must ensure the pointer is:
- non-null
- non-dangling
- aligned
References are always valid.
Sourceunsafe fn is_zst(&self) -> bool
unsafe fn is_zst(&self) -> bool
Checks whether the value is zero-sized.
§Safety
Callers must ensure the pointer is:
- non-null
- non-dangling
- aligned
References are always valid.
Sourceunsafe fn max_slice_len(&self) -> usize
unsafe fn max_slice_len(&self) -> usize
Gets the largest safe length for a slice containing copies of self.
§Safety
Callers must ensure the pointer is:
- non-null
- non-dangling
- aligned
References are always valid.