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]
M: Mutability,
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 Mut
able 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]
impl<M, T> Address<Frozen<M>, T> where
M: Mutability,
[src]
M: Mutability,
Trait Implementations
impl<M, T> Clone for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
impl<M, T> Copy for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
impl<M, T> Debug for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
impl<M, T> Eq for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
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]
M: Mutability,
pub fn hash<H>(&self, state: &mut H) where
H: Hasher,
[src]
H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<M, T> Ord for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
pub fn cmp(&self, other: &Address<M, T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<M1, M2, T1, T2> PartialEq<Address<M2, T2>> for Address<M1, T1> where
M1: Mutability,
M2: Mutability,
[src]
M1: Mutability,
M2: Mutability,
pub fn eq(&self, other: &Address<M2, T2>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<M1, M2, T1, T2> PartialOrd<Address<M2, T2>> for Address<M1, T1> where
M1: Mutability,
M2: Mutability,
[src]
M1: Mutability,
M2: Mutability,
pub fn partial_cmp(&self, other: &Address<M2, T2>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<M, T> Pointer for Address<M, T> where
M: Mutability,
[src]
M: Mutability,
impl<T> TryFrom<*const T> for Address<Const, T>
[src]
type Error = NullPtrError
The type returned in the event of a conversion error.
pub fn try_from(
elem: *const T
) -> Result<Address<Const, T>, <Address<Const, T> as TryFrom<*const T>>::Error>
[src]
elem: *const T
) -> Result<Address<Const, T>, <Address<Const, T> as TryFrom<*const T>>::Error>
impl<T> TryFrom<*mut T> for Address<Mut, T>
[src]
Auto Trait Implementations
impl<M, T> RefUnwindSafe for Address<M, T> where
M: RefUnwindSafe,
T: RefUnwindSafe,
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,
M: Unpin,
impl<M, T> UnwindSafe for Address<M, T> where
M: UnwindSafe,
T: RefUnwindSafe,
M: UnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Conv for T
[src]
impl<T> FmtForward for T
[src]
pub fn fmt_binary(self) -> FmtBinary<Self> where
Self: Binary,
[src]
Self: Binary,
pub fn fmt_display(self) -> FmtDisplay<Self> where
Self: Display,
[src]
Self: Display,
pub fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
Self: LowerExp,
[src]
Self: LowerExp,
pub fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
Self: LowerHex,
[src]
Self: LowerHex,
pub fn fmt_octal(self) -> FmtOctal<Self> where
Self: Octal,
[src]
Self: Octal,
pub fn fmt_pointer(self) -> FmtPointer<Self> where
Self: Pointer,
[src]
Self: Pointer,
pub fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
Self: UpperExp,
[src]
Self: UpperExp,
pub fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
Self: UpperHex,
[src]
Self: UpperHex,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pipe for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
[src]
pub fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
R: 'a,
[src]
R: 'a,
pub fn pipe_ref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut Self) -> R
) -> R where
R: 'a,
pub fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
[src]
Self: Borrow<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> R where
Self: BorrowMut<B>,
R: 'a,
B: 'a + ?Sized,
pub fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
[src]
Self: AsRef<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_as_mut<'a, U, R>(
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
[src]
&'a mut self,
func: impl FnOnce(&'a mut U) -> R
) -> R where
Self: AsMut<U>,
R: 'a,
U: 'a + ?Sized,
pub fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
[src]
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
pub fn pipe_deref_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
[src]
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> R where
Self: DerefMut<Target = T> + Deref,
T: 'a + ?Sized,
R: 'a,
impl<T> Tap for T
[src]
pub fn tap(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
pub fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
[src]
pub fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
[src]
pub fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
Self: Borrow<B>,
B: ?Sized,
[src]
Self: Borrow<B>,
B: ?Sized,
pub fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
Self: BorrowMut<B>,
B: ?Sized,
[src]
Self: BorrowMut<B>,
B: ?Sized,
pub fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
Self: AsRef<R>,
R: ?Sized,
[src]
Self: AsRef<R>,
R: ?Sized,
pub fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
Self: AsMut<R>,
R: ?Sized,
[src]
Self: AsMut<R>,
R: ?Sized,
pub fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self where
Self: Deref<Target = T>,
T: ?Sized,
[src]
Self: Deref<Target = T>,
T: ?Sized,
pub fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self where
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
[src]
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> TryConv for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,