Skip to main content

NodeRc

Struct NodeRc 

Source
pub struct NodeRc { /* private fields */ }
Expand description

Reference counted pointer to a Node in any Context.

It can be used to keep references to Nodes outside of the lifetime of a GCLock, but the only way to derefence and inspect the Node is to use a GCLock.

A NodeRc must not outlive its Context: dropping a Context while one is alive panics (see Context’s Drop). Should that happen anyway, the handle itself stays safe to drop and to clone — the guard leaks the storage it points at rather than freeing it — but it can no longer be dereferenced, since NodeRc::node needs a GCLock on the context it came from.

Implementations§

Source§

impl NodeRc

Source

pub fn from_node<'gc>(gc: &'gc GCLock<'_, '_>, node: &'gc Node<'gc>) -> NodeRc

Turn a node reference into a NodeRc for storage outside GCLock.

Source

pub fn node<'gc>(&self, gc: &'gc GCLock<'_, '_>) -> &'gc Node<'_>

Return the actual Node that self points to.

§Panics

Will panic if gc is not for the same context as this NodeRc was created in.

Trait Implementations§

Source§

impl Clone for NodeRc

Source§

fn clone(&self) -> Self

Cloning a NodeRc increments refcounts on the entry and the context.

1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeRc

Source§

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

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

impl Drop for NodeRc

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 Eq for NodeRc

Source§

impl Hash for NodeRc

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 PartialEq for NodeRc

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for NodeRc

§

impl !Send for NodeRc

§

impl !Sync for NodeRc

§

impl !UnwindSafe for NodeRc

§

impl Freeze for NodeRc

§

impl Unpin for NodeRc

§

impl UnsafeUnpin for NodeRc

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