Struct nom::lib::std::mem::Pin [−][src]
pub struct Pin<'a, T> where
T: 'a + ?Sized, { /* fields omitted */ }
pin
)A pinned reference.
A pinned reference is a lot like a mutable reference, except that it is not
safe to move a value out of a pinned reference unless the type of that
value implements the Unpin
trait.
Methods
impl<'a, T> Pin<'a, T> where
T: Unpin + ?Sized,
[src]
impl<'a, T> Pin<'a, T> where
T: Unpin + ?Sized,
pub fn new(reference: &'a mut T) -> Pin<'a, T>
[src]
pub fn new(reference: &'a mut T) -> Pin<'a, T>
pin
)Construct a new Pin
around a reference to some data of a type that
implements Unpin
.
impl<'a, T> Pin<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Pin<'a, T> where
T: ?Sized,
pub unsafe fn new_unchecked(reference: &'a mut T) -> Pin<'a, T>
[src]
pub unsafe fn new_unchecked(reference: &'a mut T) -> Pin<'a, T>
pin
)Construct a new Pin
around a reference to some data of a type that
may or may not implement Unpin
.
This constructor is unsafe because we do not know what will happen with that data after the reference ends. If you cannot guarantee that the data will never move again, calling this constructor is invalid.
pub fn borrow(this: &'b mut Pin<'a, T>) -> Pin<'b, T>
[src]
pub fn borrow(this: &'b mut Pin<'a, T>) -> Pin<'b, T>
pin
)Borrow a Pin for a shorter lifetime than it already has.
ⓘImportant traits for &'a mut Rpub unsafe fn get_mut(this: &'b mut Pin<'a, T>) -> &'b mut T
[src]
pub unsafe fn get_mut(this: &'b mut Pin<'a, T>) -> &'b mut T
pin
)Get a mutable reference to the data inside of this Pin
.
This function is unsafe. You must guarantee that you will never move the data out of the mutable reference you receive when you call this function.
pub unsafe fn map<U, F>(this: &'b mut Pin<'a, T>, f: F) -> Pin<'b, U> where
F: FnOnce(&mut T) -> &mut U,
[src]
pub unsafe fn map<U, F>(this: &'b mut Pin<'a, T>, f: F) -> Pin<'b, U> where
F: FnOnce(&mut T) -> &mut U,
pin
)Construct a new pin by mapping the interior value.
For example, if you wanted to get a Pin
of a field of something, you
could use this to get access to that field in one line of code.
This function is unsafe. You must guarantee that the data you return will not move so long as the argument value does not move (for example, because it is one of the fields of that value), and also that you do not move out of the argument you receive to the interior function.
Trait Implementations
impl<'a, T, U> CoerceUnsized<Pin<'a, U>> for Pin<'a, T> where
T: Unsize<U> + ?Sized,
U: ?Sized,
[src]
impl<'a, T, U> CoerceUnsized<Pin<'a, U>> for Pin<'a, T> where
T: Unsize<U> + ?Sized,
U: ?Sized,
impl<'a, T> Display for Pin<'a, T> where
T: Display + ?Sized,
[src]
impl<'a, T> Display for Pin<'a, T> where
T: Display + ?Sized,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter. Read more
impl<'a, T> Unpin for Pin<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Unpin for Pin<'a, T> where
T: ?Sized,
impl<'a, T> DerefMut for Pin<'a, T> where
T: Unpin + ?Sized,
[src]
impl<'a, T> DerefMut for Pin<'a, T> where
T: Unpin + ?Sized,
ⓘImportant traits for &'a mut Rfn deref_mut(&mut self) -> &mut T
[src]
fn deref_mut(&mut self) -> &mut T
Mutably dereferences the value.
impl<'a, T> Deref for Pin<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Deref for Pin<'a, T> where
T: ?Sized,
type Target = T
The resulting type after dereferencing.
ⓘImportant traits for &'a mut Rfn deref(&self) -> &T
[src]
fn deref(&self) -> &T
Dereferences the value.
impl<'a, T> Pointer for Pin<'a, T> where
T: ?Sized,
[src]
impl<'a, T> Pointer for Pin<'a, T> where
T: ?Sized,
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
[src]
fn fmt(&self, f: &mut Formatter) -> Result<(), Error>
Formats the value using the given formatter.
impl<'a, T> Debug for Pin<'a, T> where
T: Debug + ?Sized,
[src]
impl<'a, T> Debug for Pin<'a, T> where
T: Debug + ?Sized,