Struct UserdataSentinel

Source
pub struct UserdataSentinel<T: 'static>(/* private fields */);
Expand description

Sentinel for type-erased user data.

This consumes the user data when dropped.

Implementations§

Source§

impl<T> UserdataSentinel<T>

Source

pub const unsafe fn as_ptr(&self) -> *mut c_void

Gets underlying pointer from sentinel.

This pointer can be passed to Userdata::peek_at() to get the user data. Usually, this is not done directly but through indirection (through the third-party library that required the use of pointers for raw context data in the first place).

§Safety

The sentinel remains the owner of the data. Care must be taken to not access the data in any way past the lifetime of the sentinel.

Trait Implementations§

Source§

impl<T: Debug + 'static> Debug for UserdataSentinel<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Drop for UserdataSentinel<T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: Send> Send for UserdataSentinel<T>

Auto Trait Implementations§

§

impl<T> Freeze for UserdataSentinel<T>

§

impl<T> RefUnwindSafe for UserdataSentinel<T>
where T: RefUnwindSafe,

§

impl<T> !Sync for UserdataSentinel<T>

§

impl<T> Unpin for UserdataSentinel<T>
where T: Unpin,

§

impl<T> UnwindSafe for UserdataSentinel<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.