Struct jrsonnet_gcmodule::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 downgrade(&self) -> RawWeak<T, O>

Obtains a “weak reference”, a non-owning pointer.

source

pub fn strong_count(&self) -> usize

Gets the reference count not considering weak references.

source

pub fn ptr_eq(this: &Self, other: &Self) -> bool

Returns true if the two Ccs point to the same allocation

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

pub fn weak_count(&self) -> usize

Get the weak (non-owning) reference count.

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: ?Sized, O: AbstractObjectSpace> Clone for RawCc<T, O>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Debug + ?Sized> 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: Display + ?Sized> 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§

impl<T: Hash + ?Sized> Hash for RawCc<T, ObjectSpace>

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Ord + ?Sized> 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 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

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

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

impl<T: PartialEq + ?Sized> PartialEq for RawCc<T, ObjectSpace>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: PartialOrd + ?Sized> 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

This method tests less than (for self and other) and is used by the < operator. Read more
source§

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

This method 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

This method tests greater than (for self and other) and is used by the > operator. Read more
source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<T: ?Sized> Pointer for RawCc<T, ObjectSpace>

source§

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

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

impl<T: Eq + ?Sized> Eq for RawCc<T, ObjectSpace>

source§

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

Auto Trait Implementations§

§

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

§

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> Unpin 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> 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<T> ToOwned for T
where T: Clone,

§

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§

default 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>,

§

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>,

§

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.