[−][src]Struct eater_arc_illegal::ArcIllegal
ArcIllegal is an Arc that's illegal
ArcIllegal can always use it's contents as mutable, it sounds unsafe and is unsafe too, but now without unsafe code blocks (they're just hidden in this lib), because that's what we're Measuring these days
use eater_arc_illegal::ArcIllegal; use std::time::Duration; use std::thread::{spawn, sleep}; let mut x = ArcIllegal::new("hewwo".to_string()); let mut y = x.clone(); let mut z = y.dup(); let a = &mut *x; let b = &mut *y.dup(); let c = &mut *z.dup(); c.push_str(" wo"); b.push_str("rl"); a.push_str("d!"); y.push_str(" :)"); let mut zz = z.dup(); spawn(move || { z.push_str(" :OOO"); }); spawn(move || { zz.push_str("race!!!"); }); println!("{}", a); delay(Duration::from_millis(50)); println!("{}", a);
Implementations
impl<T> ArcIllegal<T>
[src]
pub fn new(inner: T) -> ArcIllegal<T>
[src]
Creates a new ArcIllegal for given object
pub fn as_ptr(&self) -> *mut T
[src]
Returns the raw pointer of the value
pub fn ref_count(&self) -> usize
[src]
Return the amount of references that hold this object
pub fn weak_ref_count(&self) -> usize
[src]
Return the amount of weak references that hold this object
pub fn strong_ref_count(&self) -> usize
[src]
Return the amount of "strong" references that hold this object
pub fn dup(&self) -> Self
[src]
Clones the ArcIllegal, convenience function for when the held type can be cloned
pub fn weak(&self) -> WeakIllegal<T>
[src]
Get a Weak reference to the value inside the IllegalArc
pub fn dismantle(self) -> Result<T, Self>
[src]
If we're the only reference, destroy it and give the object back as owned
pub fn dismantle_with_weak(self) -> Result<T, Self>
[src]
Trait Implementations
impl<T> Clone for ArcIllegal<T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T: Debug> Debug for ArcIllegal<T>
[src]
impl<T> Deref for ArcIllegal<T>
[src]
impl<T> DerefMut for ArcIllegal<T>
[src]
impl<T: Display> Display for ArcIllegal<T>
[src]
impl<T> Drop for ArcIllegal<T>
[src]
impl<T> Send for ArcIllegal<T>
[src]
impl<T> Sync for ArcIllegal<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for ArcIllegal<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Unpin for ArcIllegal<T>
impl<T> UnwindSafe for ArcIllegal<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
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>,