Struct Symbol

Source
pub(crate) struct Symbol<'a> {
    data: *const u8,
    marker: PhantomData<&'a SymbolCell>,
}

Fields§

§data: *const u8§marker: PhantomData<&'a SymbolCell>

Implementations§

Source§

impl<'a> Symbol<'a>

Source

pub(crate) fn get(self) -> &'a SymbolCell

Source

pub(in core) fn as_ptr( self, ) -> *const u8

Source

pub(in core) unsafe fn from_offset_ptr( ptr: *const u8, ) -> Self

Source

pub(in core) unsafe fn from_ptr( ptr: *const SymbolCell, ) -> Self

Source

pub(in core) const fn new_builtin( idx: usize, ) -> Self

Source

pub(crate) fn make_special(self)

Source

pub(crate) fn is_special(self) -> bool

Source§

impl<'new> Symbol<'_>

Source

pub(in core) fn clone_in<const C: bool>( self, bk: &'new Block<C>, ) -> Gc<Symbol<'new>>

Source§

impl<'ob> Symbol<'ob>

Source

pub(in core) fn new( name: &'static str, block: &'ob Block<true>, ) -> Self

Source

pub(crate) fn new_uninterned<const C: bool>( name: &str, block: &'ob Block<C>, ) -> Self

Methods from Deref<Target = SymbolCell>§

Source

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

Source

const EMTPTY: AtomicPtr<u8>

Source

pub(crate) fn as_bytes(&self) -> &[u8]

Source

pub(crate) fn name(&self) -> &str

Source

pub(crate) fn interned(&self) -> bool

Source

pub(crate) fn is_const(&self) -> bool

Check if the symbol is constant like nil, t, or :keyword

Source

pub(crate) fn has_func(&self) -> bool

Source

fn get(&self) -> Option<Gc<FunctionType<'_>>>

Source

pub(crate) fn func<'a>( &self, _cx: &'a Context<'_>, ) -> Option<Gc<FunctionType<'a>>>

Source

pub(crate) fn follow_indirect<'ob>( &self, cx: &'ob Context<'_>, ) -> Option<Gc<FunctionType<'ob>>>

Follow the chain of symbols to find the function at the end, if any.

Source

pub(in core) unsafe fn set_func( &self, func: Gc<FunctionType<'_>>, ) -> Result<()>

Set the function for this symbol. This function is unsafe to call and requires that the caller:

  1. Has marked the entire function as read only
  2. Has cloned the function into the SymbolMap block
  3. Ensured the symbol is not constant
Source

pub(crate) fn unbind_func(&self)

Trait Implementations§

Source§

impl<'a> Clone for Symbol<'a>

Source§

fn clone(&self) -> Symbol<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Symbol<'_>

Source§

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

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

impl Deref for Symbol<'_>

Source§

type Target = SymbolCell

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl Display for Symbol<'_>

Source§

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

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

impl<'ob> From<Symbol<'_>> for Gc<ObjectType<'ob>>

Source§

fn from(x: Symbol<'_>) -> Self

Converts to this type from the input type.
Source§

impl<'ob> From<Symbol<'ob>> for Gc<FunctionType<'ob>>

Source§

fn from(x: Symbol<'ob>) -> Self

Converts to this type from the input type.
Source§

impl<'a> GcMoveable for Symbol<'a>

Source§

type Value = Symbol<'a>

Source§

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

Source§

impl Hash for Symbol<'_>

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<Symbol<'_>> for Gc<ObjectType<'_>>

Source§

fn eq(&self, other: &Symbol<'_>) -> bool

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

const 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<'a> PartialEq for Symbol<'a>

Source§

fn eq(&self, other: &Symbol<'a>) -> bool

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

const 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 TaggedPtr for Symbol<'_>

Source§

const TAG: Tag = Tag::Symbol

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

type Ptr = u8

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

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

Given a pointer to Ptr return a Tagged pointer. Read more
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§

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 TracePtr for Symbol<'_>

Source§

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

Source§

impl<'ob> TryFrom<Gc<ObjectType<'ob>>> for Symbol<'ob>

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<'new> WithLifetime<'new> for Symbol<'_>

Source§

type Out = Symbol<'new>

Source§

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

Source§

impl<'a> Copy for Symbol<'a>

Source§

impl<'a> Eq for Symbol<'a>

Source§

impl GcPtr for Symbol<'_>

Source§

impl Send for Symbol<'_>

Source§

impl<'a> StructuralPartialEq for Symbol<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Symbol<'a>

§

impl<'a> !RefUnwindSafe for Symbol<'a>

§

impl<'a> !Sync for Symbol<'a>

§

impl<'a> Unpin for Symbol<'a>

§

impl<'a> !UnwindSafe for Symbol<'a>

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
§

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

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

§

fn vzip(self) -> V