Struct adrop::Adrop [−][src]
Adrop
wrapper can realize automatic adrop
.
Examples
use adrop::Adrop; struct Test {} impl Drop for Test { fn drop(&mut self) { println!( "Dropping HasDrop! ThreadId: {:?}", std::thread::current().id() ); } } println!("Main ThreadId: {:?}", std::thread::current().id()); let _ = Adrop::new(Test {});
Output:
Main ThreadId: ThreadId(1)
Dropping HasDrop! ThreadId: ThreadId(2)
Implementations
impl<T: Send> Adrop<T>
[src]
pub fn new(content: T) -> Adrop<T>
[src]
Wrap a value to be realize automatic adrop
.
Examples
use adrop::Adrop; Adrop::new(String::from("Hello World!"));
pub fn into_inner(self) -> T
[src]
Extracts the value from the Adrop
container.
This allows the value to be dropped again.
Examples
use adrop::Adrop; let s = Adrop::new(String::from("Hello World!")); let _ = s.into_inner();
Trait Implementations
impl<T: Clone + Send + 'static> Clone for Adrop<T>
[src]
impl<T: Debug + Send + 'static> Debug for Adrop<T>
[src]
impl<T: Default + Send + 'static> Default for Adrop<T>
[src]
impl<T: Send> Deref for Adrop<T>
[src]
impl<T: Send> DerefMut for Adrop<T>
[src]
impl<T: Send> Drop for Adrop<T>
[src]
impl<T: Eq + Send + 'static> Eq for Adrop<T>
[src]
impl<T: Hash + Send + 'static> Hash for Adrop<T>
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Ord + Send + 'static> Ord for Adrop<T>
[src]
fn cmp(&self, other: &Adrop<T>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq + Send + 'static> PartialEq<Adrop<T>> for Adrop<T>
[src]
impl<T: PartialOrd + Send + 'static> PartialOrd<Adrop<T>> for Adrop<T>
[src]
fn partial_cmp(&self, other: &Adrop<T>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: Send + 'static> StructuralEq for Adrop<T>
[src]
impl<T: Send + 'static> StructuralPartialEq for Adrop<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Adrop<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Adrop<T>
impl<T> Sync for Adrop<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Adrop<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Adrop<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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub 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.
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>,