Struct compact_rc::rc::RcX

source ·
pub struct RcX<T: ?Sized, C>(_)
where
         Cell<C>: RefCount;
Expand description

Low-memory version of std::rc::Rc.

A type provides almost the same methods as standard Rc. See the top page for about differences from the standard Rc.

There are aliases for simplicity.

Implementations§

source§

impl<T, C> RcX<T, C>where Cell<C>: RefCount,

source

pub fn new(value: T) -> RcX<T, C>

source

pub fn pin(value: T) -> Pin<RcX<T, C>>

source

pub fn try_unwrap(this: Self) -> Result<T, Self>

source

pub unsafe fn from_raw(ptr: *const T) -> Self

See std::rc::Rc::from_raw.

Incompatibility

Unlike the standard Rc, this method does not support dynamically sized types (DSTs) because some unstabilized features are required to implement this for DSTs.

source

pub unsafe fn increment_strong_count(ptr: *const T)

source

pub unsafe fn decrement_strong_count(ptr: *const T)

source

pub fn into_inner(this: Self) -> Option<T>

source§

impl<T: ?Sized, C> RcX<T, C>where Cell<C>: RefCount,

source§

impl<T: Clone, C> RcX<T, C>where Cell<C>: RefCount,

Trait Implementations§

source§

impl<T: ?Sized, C> AsRef<T> for RcX<T, C>where Cell<C>: RefCount,

source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T: ?Sized, C> Borrow<T> for RcX<T, C>where Cell<C>: RefCount,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T: ?Sized, C> Clone for RcX<T, C>where Cell<C>: RefCount,

source§

fn clone(&self) -> RcX<T, C>

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: ?Sized + Debug, C> Debug for RcX<T, C>where Cell<C>: RefCount,

source§

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

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

impl<T: Default, C> Default for RcX<T, C>where Cell<C>: RefCount,

source§

fn default() -> RcX<T, C>

Returns the “default value” for a type. Read more
source§

impl<T: ?Sized, C> Deref for RcX<T, C>where Cell<C>: RefCount,

§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T: ?Sized + Display, C> Display for RcX<T, C>where Cell<C>: RefCount,

source§

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

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

impl<T: Clone, C> From<&[T]> for RcX<[T], C>where Cell<C>: RefCount,

source§

fn from(v: &[T]) -> RcX<[T], C>

Converts to this type from the input type.
source§

impl<C> From<&CStr> for RcX<CStr, C>where Cell<C>: RefCount,

source§

fn from(s: &CStr) -> RcX<CStr, C>

Converts to this type from the input type.
source§

impl<C> From<&str> for RcX<str, C>where Cell<C>: RefCount,

source§

fn from(s: &str) -> RcX<str, C>

Converts to this type from the input type.
source§

impl<T, C> From<Box<T, Global>> for RcX<T, C>where Cell<C>: RefCount,

source§

fn from(b: Box<T>) -> RcX<T, C>

Converts to this type from the input type.
source§

impl<C> From<CString> for RcX<CStr, C>where Cell<C>: RefCount,

source§

fn from(s: CString) -> RcX<CStr, C>

Converts to this type from the input type.
source§

impl<'a, B, C> From<Cow<'a, B>> for RcX<B, C>where Cell<C>: RefCount, B: ToOwned + ?Sized, RcX<B, C>: From<&'a B> + From<B::Owned>,

source§

fn from(cow: Cow<'a, B>) -> RcX<B, C>

Converts to this type from the input type.
source§

impl<C> From<RcX<str, C>> for RcX<[u8], C>where Cell<C>: RefCount,

source§

fn from(rc: RcX<str, C>) -> Self

Converts to this type from the input type.
source§

impl<C> From<String> for RcX<str, C>where Cell<C>: RefCount,

source§

fn from(s: String) -> RcX<str, C>

Converts to this type from the input type.
source§

impl<T, C> From<T> for RcX<T, C>where Cell<C>: RefCount,

source§

fn from(t: T) -> Self

Converts to this type from the input type.
source§

impl<T, C> From<Vec<T, Global>> for RcX<[T], C>where Cell<C>: RefCount,

source§

fn from(v: Vec<T>) -> RcX<[T], C>

Converts to this type from the input type.
source§

impl<T, C> FromIterator<T> for RcX<[T], C>where Cell<C>: RefCount,

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
source§

impl<T: ?Sized + Hash, C> Hash for RcX<T, C>where Cell<C>: RefCount,

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: ?Sized + Ord, C> Ord for RcX<T, C>where Cell<C>: RefCount,

source§

fn cmp(&self, other: &RcX<T, C>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

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

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

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

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

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

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

impl<T: ?Sized + PartialEq, C> PartialEq<RcX<T, C>> for RcX<T, C>where Cell<C>: RefCount,

source§

fn eq(&self, other: &RcX<T, C>) -> bool

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

fn ne(&self, other: &RcX<T, C>) -> bool

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

impl<T: ?Sized + PartialOrd, C> PartialOrd<RcX<T, C>> for RcX<T, C>where Cell<C>: RefCount,

source§

fn partial_cmp(&self, other: &RcX<T, C>) -> Option<Ordering>

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

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

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

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

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

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

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

fn ge(&self, other: &Rhs) -> 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, C> Pointer for RcX<T, C>where Cell<C>: RefCount,

source§

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

Formats the value using the given formatter.
source§

impl<T, C, const N: usize> TryFrom<RcX<[T], C>> for RcX<[T; N], C>where Cell<C>: RefCount,

§

type Error = RcX<[T], C>

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

fn try_from(boxed_slice: RcX<[T], C>) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T: ?Sized + Eq, C> Eq for RcX<T, C>where Cell<C>: RefCount,

Auto Trait Implementations§

§

impl<T: ?Sized, C> RefUnwindSafe for RcX<T, C>where T: RefUnwindSafe,

§

impl<T, C> !Send for RcX<T, C>

§

impl<T, C> !Sync for RcX<T, C>

§

impl<T: ?Sized, C> Unpin for RcX<T, C>

§

impl<T: ?Sized, C> UnwindSafe for RcX<T, C>where T: RefUnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<!> for T

source§

fn from(t: !) -> T

Converts to this type from the input type.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere 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 Twhere 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 Twhere 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 Twhere 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.