Skip to main content

RawCc

Struct RawCc 

Source
pub struct RawCc<T: ?Sized, O: AbstractObjectSpace>(/* private fields */);
Expand description

Low-level type for Cc<T>.

Implementations§

Source§

impl<T: Trace> RawCc<T, ObjectSpace>

Source

pub fn new(value: T) -> Cc<T>

Constructs a new Cc<T> in a thread-local storage.

To collect cycles, use collect_thread_cycles.

Source§

impl<T: Trace, O: AbstractObjectSpace> RawCc<T, O>

Source

pub fn into_dyn(self) -> RawCc<dyn Trace, O>

Convert to RawCc<dyn Trace>.

Source§

impl<T: Trace + Clone> RawCc<T, ObjectSpace>

Source

pub fn update_with(&mut self, update_func: impl FnMut(&mut T))

Update the value T in a copy-on-write way.

If the ref count is 1, the value is updated in-place. Otherwise a new Cc<T> will be created.

Source§

impl<T: ?Sized, O: AbstractObjectSpace> RawCc<T, O>

Source

pub fn trace(&self, tracer: &mut Tracer<'_>)

trace without T: Trace bound.

Useful for structures with Cc<T> fields where T does not implement Trace. For example, struct S(Cc<Box<dyn MyTrait>>). To implement Trace for S, it can use Cc::trace(&self.0, tracer).

Source§

impl<T: ?Sized> RawCc<T, ThreadedObjectSpace>

Source

pub fn borrow(&self) -> ThreadedCcRef<'_, T>

Immutably borrows the wrapped value.

The borrow lasts until the returned value exits scope.

Trait Implementations§

Source§

impl<T, O: AbstractObjectSpace> Clone for RawCc<T, O>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for RawCc<T, ObjectSpace>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Debug> Display for RawCc<T, ObjectSpace>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: ?Sized, O: AbstractObjectSpace> Drop for RawCc<T, O>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: Eq> Eq for RawCc<T, ObjectSpace>

Source§

impl<T: Ord> Ord for RawCc<T, ObjectSpace>

Source§

fn cmp(&self, other: &RawCc<T, O>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq> PartialEq for RawCc<T, ObjectSpace>

Source§

fn eq(&self, other: &RawCc<T, O>) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &RawCc<T, O>) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for RawCc<T, ObjectSpace>

Source§

fn partial_cmp(&self, other: &RawCc<T, O>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &RawCc<T, O>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &RawCc<T, O>) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
Source§

fn gt(&self, other: &RawCc<T, O>) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
Source§

fn ge(&self, other: &RawCc<T, O>) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations§

§

impl<T, O> !RefUnwindSafe for RawCc<T, O>

§

impl<T, O> !Send for RawCc<T, O>

§

impl<T, O> !Sync for RawCc<T, O>

§

impl<T, O> !UnwindSafe for RawCc<T, O>

§

impl<T, O> Freeze for RawCc<T, O>
where T: ?Sized,

§

impl<T, O> Unpin for RawCc<T, O>
where T: ?Sized,

§

impl<T, O> UnsafeUnpin for RawCc<T, O>
where T: ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.