Struct SymbolCell

Source
pub(crate) struct SymbolCell(GcHeap<SymbolCellData>);
Expand description

The allocation of a global symbol. This is shared between threads, so the interned value of a symbol will be the same location no matter which thread interned it. Functions are safe to share between threads because they are marked immutable by SymbolMap::set_func and they can only be replaced atomically. In order to garbage collect the function we need to halt all running threads. This has not been implemented yet.

Tuple Fields§

§0: GcHeap<SymbolCellData>

Implementations§

Source§

impl SymbolCell

Source

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

Source

const EMTPTY: AtomicPtr<u8>

Source

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

Source

fn new_normal(name: &'static str, block: &Block<true>) -> Self

Source

pub(in core) const fn new_static( name: &'static str, ) -> Self

Source

pub(in core) const fn new_static_special( name: &'static str, ) -> Self

Source

fn new_const(name: &'static str, _block: &Block<true>) -> Self

Source

pub(in core) const fn new_static_const( name: &'static str, ) -> Self

Source

fn new_uninterned<const C: bool>(name: &str, bk: &Block<C>) -> Self

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 Debug for SymbolCell

Source§

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

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

impl Display for SymbolCell

Source§

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

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

impl IntoObject for SymbolCell

Source§

type Out<'ob> = Symbol<'ob>

Source§

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

Source§

impl PartialEq for SymbolCell

Source§

fn eq(&self, other: &Self) -> 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 Trace for SymbolCell

Source§

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

Auto Trait Implementations§

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