Struct bitvec::ptr::Address[][src]

pub struct Address<M, T> where
    M: Mutability
{ /* fields omitted */ }

A generic non-null pointer with type-system mutability tracking.

Type Parameters

  • M: The mutability permissions of the source pointer.
  • T: The referent type of the source pointer.

Implementations

impl<M, T> Address<M, T> where
    M: Mutability
[src]

pub const DANGLING: Address<M, T>[src]

The dangling pointer.

pub fn new(addr: NonNull<T>) -> Address<M, T>[src]

Constructs a new Address over some pointer value.

You are responsible for selecting the correct Mutability marker.

pub fn immut(self) -> Address<Const, T>[src]

Permanently converts an Address<_> into an Address<Const>.

You should generally prefer Address::freeze.

pub unsafe fn assert_mut(self) -> Address<Mut, T>[src]

Force an Address<Const> to be Address<Mut>.

Safety

You should only call this on addresses you know to have been created with Mutable permissions and previously removed by Address::immut.

You should prefer using Address::freeze for temporary, trackable, immutability constraints instead.

pub fn freeze(self) -> Address<Frozen<M>, T>[src]

Freezes the Address so that it is read-only.

pub fn into_inner(self) -> NonNull<T>[src]

Removes the Address type marker, returning the original pointer.

pub unsafe fn offset(self, count: isize) -> Address<M, T>[src]

Applies <*T>::offset.

Panics

This panics if the result of applying the offset is the null pointer.

Safety

See pointer::offset.

pub fn wrapping_offset(self, count: isize) -> Address<M, T>[src]

Applies <*T>::wrapping_offset.

Panics

This panics if the result of applying the offset is the null pointer.

pub fn to_const(self) -> *const T[src]

Gets the address as a read-only pointer.

pub fn cast<U>(self) -> Address<M, U>[src]

Changes the referent type of the pointer.

impl<T> Address<Mut, T>[src]

pub fn to_mut(self) -> *mut T[src]

Gets the address as a write-capable pointer.

impl<M, T> Address<Frozen<M>, T> where
    M: Mutability
[src]

pub fn thaw(self) -> Address<M, T>[src]

Thaws the Address to its original mutability permission.

Trait Implementations

impl<M, T> Clone for Address<M, T> where
    M: Mutability
[src]

impl<M, T> Copy for Address<M, T> where
    M: Mutability
[src]

impl<M, T> Debug for Address<M, T> where
    M: Mutability
[src]

impl<M, T> Eq for Address<M, T> where
    M: Mutability
[src]

impl<'_, T> From<&'_ T> for Address<Const, T>[src]

impl<'_, T> From<&'_ mut T> for Address<Mut, T>[src]

impl<M, T> Hash for Address<M, T> where
    M: Mutability
[src]

impl<M, T> Ord for Address<M, T> where
    M: Mutability
[src]

impl<M1, M2, T1, T2> PartialEq<Address<M2, T2>> for Address<M1, T1> where
    M1: Mutability,
    M2: Mutability
[src]

impl<M1, M2, T1, T2> PartialOrd<Address<M2, T2>> for Address<M1, T1> where
    M1: Mutability,
    M2: Mutability
[src]

impl<M, T> Pointer for Address<M, T> where
    M: Mutability
[src]

impl<T> TryFrom<*const T> for Address<Const, T>[src]

type Error = NullPtrError

The type returned in the event of a conversion error.

impl<T> TryFrom<*mut T> for Address<Mut, T>[src]

type Error = NullPtrError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<M, T> RefUnwindSafe for Address<M, T> where
    M: RefUnwindSafe,
    T: RefUnwindSafe

impl<M, T> !Send for Address<M, T>

impl<M, T> !Sync for Address<M, T>

impl<M, T> Unpin for Address<M, T> where
    M: Unpin

impl<M, T> UnwindSafe for Address<M, T> where
    M: UnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T[src]

impl<T> FmtForward for T[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized
[src]

impl<T> Tap for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.