[−][src]Struct finarc::FinArc
Methods
impl<T, F> FinArc<T, F> where
F: FnOnce(&mut T),
[src]
F: FnOnce(&mut T),
pub fn new(data: T, finalizer: F) -> Self
[src]
pub fn try_unwrap(this: Self) -> Result<T, Self>
[src]
Returns the contained value, if this is the last instance of FinArc, without running finalizer
Otherwise, an Err
is returned with the same FinArc
that was
passed in.
Examples
use finarc::FinArc; let x = FinArc::new(3, |_|{}); assert_eq!(FinArc::try_unwrap(x), Ok(3)); let x = FinArc::new(4, |_|{}); let _y = FinArc::clone(&x); assert_eq!(*FinArc::try_unwrap(x).unwrap_err(), 4);
Analogue of Arc::try_unwrap
Trait Implementations
impl<T, F> Clone for FinArc<T, F> where
T: Clone,
F: FnOnce(&mut T),
[src]
T: Clone,
F: FnOnce(&mut T),
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: ?Sized + Debug, F: FnOnce(&mut T)> Debug for FinArc<T, F>
[src]
impl<T, F> Deref for FinArc<T, F> where
T: ?Sized,
F: FnOnce(&mut T),
[src]
T: ?Sized,
F: FnOnce(&mut T),
impl<T, F> DerefMut for FinArc<T, F> where
T: ?Sized,
F: FnOnce(&mut T),
[src]
T: ?Sized,
F: FnOnce(&mut T),
impl<T: ?Sized + Display, F: FnOnce(&mut T)> Display for FinArc<T, F>
[src]
impl<T, F> Drop for FinArc<T, F> where
T: ?Sized,
F: FnOnce(&mut T),
[src]
T: ?Sized,
F: FnOnce(&mut T),
impl<T: ?Sized + Eq, F: FnOnce(&mut T)> Eq for FinArc<T, F>
[src]
impl<T: ?Sized + Ord, F: FnOnce(&mut T)> Ord for FinArc<T, F>
[src]
fn cmp(&self, other: &FinArc<T, F>) -> Ordering
[src]
Comparison for two FinArc
s.
The two are compared by calling cmp()
on their inner values.
Examples
use finarc::FinArc; use std::cmp::Ordering; let five = FinArc::new(5, |_|{}); let mut six = FinArc::clone(&five); *six = 6; assert_eq!(Ordering::Less, five.cmp(&six));
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: ?Sized, F, F1> PartialEq<FinArc<T, F1>> for FinArc<T, F> where
T: PartialEq,
F: FnOnce(&mut T),
F1: FnOnce(&mut T),
[src]
T: PartialEq,
F: FnOnce(&mut T),
F1: FnOnce(&mut T),
We ignore finalizers when comparing FinArc's, so they may be of different types
fn eq(&self, other: &FinArc<T, F1>) -> bool
[src]
Equality for two FinArc
s.
Two FinArc
s are equal if their inner values are equal.
If T
also implements Eq
, two FinArc
s that point to the same value are
always equal.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five == FinArc::new(5, |_|{}));
fn ne(&self, other: &FinArc<T, F1>) -> bool
[src]
Inequality for two FinArc
s.
Two FinArc
s are unequal if their inner values are unequal.
If T
also implements Eq
, two FinArc
s that point to the same value are
never unequal.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five != FinArc::new(6, |_|{}));
impl<T: ?Sized, F, F1> PartialOrd<FinArc<T, F1>> for FinArc<T, F> where
T: PartialOrd,
F: FnOnce(&mut T),
F1: FnOnce(&mut T),
[src]
T: PartialOrd,
F: FnOnce(&mut T),
F1: FnOnce(&mut T),
We ignore finalizers when comparing FinArc's, so they may be of different types
fn partial_cmp(&self, other: &FinArc<T, F1>) -> Option<Ordering>
[src]
Partial comparison for two FinArc
s.
The two are compared by calling partial_cmp()
on their inner values.
Examples
use finarc::FinArc; use std::cmp::Ordering; let five = FinArc::new(5, |_|{}); assert_eq!(Some(Ordering::Less), five.partial_cmp(&FinArc::new(6, |_|{})));
fn lt(&self, other: &FinArc<T, F1>) -> bool
[src]
Less-than comparison for two FinArc
s.
The two are compared by calling <
on their inner values.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five < FinArc::new(6, |_|{}));
fn le(&self, other: &FinArc<T, F1>) -> bool
[src]
'Less than or equal to' comparison for two FinArc
s.
The two are compared by calling <=
on their inner values.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five <= FinArc::new(5, |_|{}));
fn gt(&self, other: &FinArc<T, F1>) -> bool
[src]
Greater-than comparison for two FinArc
s.
The two are compared by calling >
on their inner values.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five > FinArc::new(4, |_|{}));
fn ge(&self, other: &FinArc<T, F1>) -> bool
[src]
'Greater than or equal to' comparison for two FinArc
s.
The two are compared by calling >=
on their inner values.
Examples
use finarc::FinArc; let five = FinArc::new(5, |_|{}); assert!(five >= FinArc::new(5, |_|{}));
Auto Trait Implementations
impl<T: ?Sized, F> RefUnwindSafe for FinArc<T, F> where
F: RefUnwindSafe,
T: RefUnwindSafe,
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, F> Send for FinArc<T, F> where
F: Send + Sync,
T: Send,
F: Send + Sync,
T: Send,
impl<T: ?Sized, F> Sync for FinArc<T, F> where
F: Send + Sync,
T: Sync,
F: Send + Sync,
T: Sync,
impl<T: ?Sized, F> Unpin for FinArc<T, F> where
T: Unpin,
T: Unpin,
impl<T: ?Sized, F> UnwindSafe for FinArc<T, F> where
F: RefUnwindSafe,
T: UnwindSafe,
F: RefUnwindSafe,
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,
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.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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>,