PtrProps

Trait PtrProps 

Source
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§

Source

unsafe fn sz(&self) -> usize

Gets the size of the value.

§Safety

Callers must ensure the pointer is:

  • non-null
  • non-dangling
  • aligned

References are always valid.

Source

unsafe fn aln(&self) -> usize

Gets the alignment of the value.

§Safety

Callers must ensure the pointer is:

  • non-null
  • non-dangling
  • aligned

References are always valid.

Provided Methods§

Source

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.

Source

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.

Source

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.

Implementations on Foreign Types§

Source§

impl<T: ?Sized> PtrProps<T> for *const T

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for *mut T

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for &T

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for &mut T

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for Box<T>

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for Rc<T>

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for Arc<T>

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Source§

impl<T: ?Sized> PtrProps<T> for NonNull<T>

Source§

unsafe fn sz(&self) -> usize

Source§

unsafe fn aln(&self) -> usize

Implementors§