[−][src]Struct field_offset::FieldOffset
Represents a pointer to a field of type U
within the type T
Methods
impl<T, U> FieldOffset<T, U>
[src]
pub unsafe fn new<F: for<'a> FnOnce(*const T) -> *const U>(f: F) -> Self
[src]
Construct a field offset via a lambda which returns a reference to the field in question.
The lambda must not access the value passed in.
pub unsafe fn new_from_offset(offset: usize) -> Self
[src]
Construct a field offset directly from a byte offset.
pub fn apply_ptr<'a>(&self, x: *const T) -> *const U
[src]
Apply the field offset to a native pointer.
pub fn apply_ptr_mut<'a>(&self, x: *mut T) -> *mut U
[src]
Apply the field offset to a native mutable pointer.
pub fn apply<'a>(&self, x: &'a T) -> &'a U
[src]
Apply the field offset to a reference.
pub fn apply_mut<'a>(&self, x: &'a mut T) -> &'a mut U
[src]
Apply the field offset to a mutable reference.
pub fn get_byte_offset(&self) -> usize
[src]
Get the raw byte offset for this field offset.
pub unsafe fn unapply_ptr<'a>(&self, x: *const U) -> *const T
[src]
Unapply the field offset to a native pointer.
Warning: very unsafe!
pub unsafe fn unapply_ptr_mut<'a>(&self, x: *mut U) -> *mut T
[src]
Unapply the field offset to a native mutable pointer.
Warning: very unsafe!
pub unsafe fn unapply<'a>(&self, x: &'a U) -> &'a T
[src]
Unapply the field offset to a reference.
Warning: very unsafe!
pub unsafe fn unapply_mut<'a>(&self, x: &'a mut U) -> &'a mut T
[src]
Unapply the field offset to a mutable reference.
Warning: very unsafe!
Trait Implementations
impl<T, U, V> Add<FieldOffset<U, V>> for FieldOffset<T, U>
[src]
Allow chaining pointer-to-members.
Applying the resulting field offset is equivalent to applying the first field offset, then applying the second field offset.
The requirements on the generic type parameters ensure this is a safe operation.
type Output = FieldOffset<T, V>
The resulting type after applying the +
operator.
fn add(self, other: FieldOffset<U, V>) -> FieldOffset<T, V>
[src]
impl<T, U> Clone for FieldOffset<T, U>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T, U> Copy for FieldOffset<T, U>
[src]
impl<T, U> Debug for FieldOffset<T, U>
[src]
The debug implementation prints the byte offset of the field in hexadecimal.
Auto Trait Implementations
impl<T, U> !RefUnwindSafe for FieldOffset<T, U>
impl<T, U> !Send for FieldOffset<T, U>
impl<T, U> !Sync for FieldOffset<T, U>
impl<T, U> !Unpin for FieldOffset<T, U>
impl<T, U> !UnwindSafe for FieldOffset<T, U>
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut 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.
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>,