Trait deferred_reference::PointerLength[][src]

pub unsafe trait PointerLength {
    fn len(ptr: *const Self) -> usize;
}

A trait which is only implemented for pointers for which the length of the pointee can be determined without creating a reference to the pointee and without accessing the pointee. This means that the pointer is not dereferenced.

Example

use deferred_reference::PointerLength;
let array = [0usize; 1024];
assert_eq!(1024, PointerLength::len(core::ptr::addr_of!(array)));

Safety

This trait is unsafe. The implementor must promise never to access or create a reference to the pointee.

Required methods

fn len(ptr: *const Self) -> usize[src]

Obtains the length of the pointee, without creating an intermediate reference.

Loading content...

Implementors

impl<T> PointerLength for [T][src]

impl<T, const N: usize> PointerLength for [T; N][src]

Loading content...