Struct ste::Tagged [−][src]
An object T
which can only be used on the thread with the corresponding
tag.
Dropping tagged elements
Dropping a tagged container outside of its thread and the underlying T
implements Drop will cause it to panic.
The correct way to drop it is to move it back onto the thread, use use the provided Thread::drop.
Examples
// Ensure that `Foo` is `!Send` and `!Sync`. struct Foo(*mut ()); impl Foo { fn test(&self) -> u32 { 42 } } impl Drop for Foo { fn drop(&mut self) { println!("Foo was dropped"); } } let thread = ste::Thread::new()?; let value = thread.submit(|| ste::Tagged::new(Foo(0 as *mut ())))?; let out = thread.submit(|| value.test())?; assert_eq!(42, out); thread.drop(value)?; thread.join()?;
Implementations
impl<T> Tagged<T>
[src]
Trait Implementations
impl<T> Deref for Tagged<T>
[src]
impl<T> DerefMut for Tagged<T>
[src]
impl<T> Drop for Tagged<T>
[src]
impl<T> Send for Tagged<T>
[src]
impl<T> Sync for Tagged<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Tagged<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Unpin for Tagged<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Tagged<T> where
T: UnwindSafe,
T: UnwindSafe,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,