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>
impl<'a> Symbol<'a>
pub(crate) fn get(self) -> &'a SymbolCell
pub(in core) fn as_ptr( self, ) -> *const u8
pub(in core) unsafe fn from_offset_ptr( ptr: *const u8, ) -> Self
pub(in core) unsafe fn from_ptr( ptr: *const SymbolCell, ) -> Self
pub(in core) const fn new_builtin( idx: usize, ) -> Self
pub(crate) fn make_special(self)
pub(crate) fn is_special(self) -> bool
Methods from Deref<Target = SymbolCell>§
const NULL: *mut u8 = {0x0 as *mut u8}
const EMTPTY: AtomicPtr<u8>
pub(crate) fn as_bytes(&self) -> &[u8] ⓘ
pub(crate) fn name(&self) -> &str
pub(crate) fn interned(&self) -> bool
pub(crate) fn has_func(&self) -> bool
fn get(&self) -> Option<Gc<FunctionType<'_>>>
pub(crate) fn func<'a>( &self, _cx: &'a Context<'_>, ) -> Option<Gc<FunctionType<'a>>>
Sourcepub(crate) fn follow_indirect<'ob>(
&self,
cx: &'ob Context<'_>,
) -> Option<Gc<FunctionType<'ob>>>
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.
Sourcepub(in core) unsafe fn set_func(
&self,
func: Gc<FunctionType<'_>>,
) -> Result<()>
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:
- Has marked the entire function as read only
- Has cloned the function into the
SymbolMap
block - Ensured the symbol is not constant
pub(crate) fn unbind_func(&self)
Trait Implementations§
Source§impl<'a> GcMoveable for Symbol<'a>
impl<'a> GcMoveable for Symbol<'a>
Source§impl TaggedPtr for Symbol<'_>
impl TaggedPtr for Symbol<'_>
Source§const TAG: Tag = Tag::Symbol
const TAG: Tag = Tag::Symbol
Tag value. This is only applicable to base values. Use Int for sum
types.
Source§type Ptr = u8
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>
unsafe fn tag_ptr(ptr: *const Self::Ptr) -> Gc<Self>
Given a pointer to
Ptr
return a Tagged pointer. Read moreSource§unsafe fn from_obj_ptr(ptr: *const u8) -> Self
unsafe fn from_obj_ptr(ptr: *const u8) -> Self
Given an untyped pointer, reinterpret to self. Read more
Source§fn untag(val: Gc<Self>) -> Self
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 moreSource§impl<'new> WithLifetime<'new> for Symbol<'_>
impl<'new> WithLifetime<'new> for Symbol<'_>
impl<'a> Copy for Symbol<'a>
impl<'a> Eq for Symbol<'a>
impl GcPtr for Symbol<'_>
impl Send for Symbol<'_>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
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
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.