rune::core::cons

Struct Cons

Source
pub(crate) struct Cons(GcHeap<ConsInner>);

Tuple Fields§

§0: GcHeap<ConsInner>

Implementations§

Source§

impl Cons

Source

pub(crate) fn elements(&self) -> ElemIter<'_>

Source

pub(crate) fn conses(&self) -> ConsIter<'_>

Source§

impl Cons

Source

unsafe fn new_unchecked( car: Gc<ObjectType<'_>>, cdr: Gc<ObjectType<'_>>, ) -> ConsInner

Source

pub(crate) fn new<'ob, T, Tx, U, Ux, const C: bool>( car: T, cdr: U, cx: &'ob Block<C>, ) -> &'ob Self
where T: IntoObject<Out<'ob> = Tx>, Gc<Tx>: Into<Gc<ObjectType<'ob>>>, U: IntoObject<Out<'ob> = Ux>, Gc<Ux>: Into<Gc<ObjectType<'ob>>>,

Create a new cons cell

Source

pub(crate) fn new1<'ob, T, Tx, const C: bool>( car: T, cx: &'ob Block<C>, ) -> &'ob Self
where T: IntoObject<Out<'ob> = Tx>, Gc<Tx>: Into<Gc<ObjectType<'ob>>>,

Create a new cons cell with the cdr set to nil

Source

pub(super) fn mark_const(&mut self)

Source§

impl Cons

Source

pub(super) fn display_walk( &self, f: &mut Formatter<'_>, seen: &mut HashSet<*const u8>, ) -> Result

Source

fn is_backref(&self, seen: &mut HashSet<*const u8>) -> bool

Methods from Deref<Target = GcHeap<ConsInner>>§

Source

const NULL: *mut u8 = {0x0 as *mut u8}

Source

const EMTPTY: AtomicPtr<u8> = _

Source

fn header(&self) -> &GcHeader

Source

pub(in core) fn forward( &self, fwd_ptr: NonNull<u8>, )

Source

pub(in core) fn allocation_state( &self, ) -> AllocState

Source

fn is_marked(&self) -> bool

Trait Implementations§

Source§

impl<'new> CloneIn<'new, &'new Cons> for Cons

Source§

fn clone_in<const C: bool>(&self, bk: &'new Block<C>) -> Gc<&'new Cons>

Source§

impl<'ob> IntoIterator for &'ob Cons

Source§

type Item = <ElemIter<'ob> as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = ElemIter<'ob>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoObject for Cons

Source§

type Out<'ob> = &'ob Cons

Source§

fn into_obj<const C: bool>(self, block: &Block<C>) -> Gc<Self::Out<'_>>

Source§

impl Markable for Cons

Source§

type Value = NonNull<Cons>

Source§

fn move_value(&self, to_space: &Bump) -> Option<(Self::Value, bool)>

Source§

impl PartialEq for Cons

Source§

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

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

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

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

impl RootedDeref for Cons

Source§

type Target = RootedCons

Source§

fn rooted_deref(rooted: &Rt<Self>) -> &Self::Target

Source§

fn rooted_derefmut(rooted: &mut Rt<Self>) -> &mut Self::Target

Source§

impl TaggedPtr for &Cons

Source§

const TAG: Tag = Tag::Cons

Tag value. This is only applicable to base values. Use Int for sum types.
Source§

type Ptr = Cons

The type of object being pointed to. This will be different for all implementors.
Source§

unsafe fn from_obj_ptr(ptr: *const u8) -> Self

Given an untyped pointer, reinterpret to self. Read more
Source§

fn get_ptr(self) -> *const Self::Ptr

Get the underlying pointer. Read more
Source§

unsafe fn tag_ptr(ptr: *const Self::Ptr) -> Gc<Self>

Given a pointer to Ptr return a Tagged pointer. Read more
Source§

fn untag(val: Gc<Self>) -> Self

Remove the tag from the Gc<T> and return the inner type. If it is base type then it will only have a single possible value and can be untagged without checks, but sum types need to create all values they can hold. We use tagged base types to let us reinterpret bits without actually modify them. Read more
Source§

fn tag(self) -> Gc<Self>

Given the type, return a tagged version of it. When using a sum type or an immediate value like i64, we override this method to set the proper tag. Read more
Source§

impl Trace for Cons

Source§

fn trace(&self, state: &mut GcState)

Source§

impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for &'ob Cons

Source§

type Error = TypeError

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

fn try_from(obj: Gc<ObjectType<'ob>>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'old, 'new> WithLifetime<'new> for &'old Cons

Source§

type Out = &'new Cons

Source§

unsafe fn with_lifetime(self) -> Self::Out

Source§

impl<'ob> From<&'ob Cons> for Gc<FunctionType<'ob>>

Source§

fn from(x: &'ob Cons) -> Self

Converts to this type from the input type.
Source§

impl<'ob> From<&'ob Cons> for Gc<ListType<'ob>>

Source§

fn from(x: &'ob Cons) -> Self

Converts to this type from the input type.
Source§

impl<'ob> From<&'ob Cons> for Gc<ObjectType<'ob>>

Source§

fn from(x: &'ob Cons) -> Self

Converts to this type from the input type.
Source§

impl Debug for Cons

Source§

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

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

impl Display for Cons

Source§

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

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

impl Deref for Cons

Source§

type Target = GcHeap<ConsInner>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Eq for Cons

Source§

impl GcPtr for &Cons

Source§

impl StructuralPartialEq for Cons

Auto Trait Implementations§

§

impl !Freeze for Cons

§

impl !RefUnwindSafe for Cons

§

impl Send for Cons

§

impl !Sync for Cons

§

impl Unpin for Cons

§

impl !UnwindSafe for Cons

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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>,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.