pub struct Once<T>(/* private fields */);
Expand description
Special user-data wrapper intended for objects that can only be used once. Only
implements MapOwned
.
Trait Implementations§
Source§impl<T> MapOwned for Once<T>where
T: NativeClass + Send,
impl<T> MapOwned for Once<T>where
T: NativeClass + Send,
Source§fn map_owned<F, U>(&self, op: F) -> Result<U, Self::Err>
fn map_owned<F, U>(&self, op: F) -> Result<U, Self::Err>
Maps a T
to U
. Called for methods that take self
. This method may fail with
an error if it is called more than once on the same object.
Implementations of this method must not panic. Failures should be indicated by
returning Err
.
type Err = ValueTaken
Source§impl<T> UserData for Once<T>where
T: NativeClass + Send,
impl<T> UserData for Once<T>where
T: NativeClass + Send,
type Target = T
Source§fn new(val: Self::Target) -> Self
fn new(val: Self::Target) -> Self
Creates a new owned wrapper from a
NativeClass
instance. Read moreSource§fn into_user_data(self) -> *const c_void
fn into_user_data(self) -> *const c_void
Takes a native instance and returns an opaque pointer that can be used to recover it. Read more
Auto Trait Implementations§
impl<T> Freeze for Once<T>
impl<T> !RefUnwindSafe for Once<T>
impl<T> Send for Once<T>where
T: Send,
impl<T> Sync for Once<T>where
T: Send,
impl<T> Unpin for Once<T>
impl<T> !UnwindSafe for Once<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more