[][src]Struct eater_arc_illegal::ArcIllegal

pub struct ArcIllegal<T> { /* fields omitted */ }

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");
y.push_str(" :)");

let mut zz = z.dup();

spawn(move || {
    z.push_str(" :OOO");

spawn(move || {

println!("{}", a);
println!("{}", a);


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]

impl<T: Debug> Debug for ArcIllegal<T>[src]

impl<T> Deref for ArcIllegal<T>[src]

type Target = T

The resulting type after dereferencing.

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

impl<T> Unpin for ArcIllegal<T>

impl<T> UnwindSafe for ArcIllegal<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.