Struct forth3::dictionary::Dictionary
source · pub struct Dictionary<T: 'static> {
pub(crate) tail: Option<NonNull<DictionaryEntry<T>>>,
pub(crate) alloc: DictionaryBump,
refs: AtomicUsize,
parent: Option<SharedDict<T>>,
deallocate: unsafe fn(ptr: NonNull<u8>, layout: Layout),
}
Fields§
§tail: Option<NonNull<DictionaryEntry<T>>>
§alloc: DictionaryBump
§refs: AtomicUsize
Reference count, used to determine when the dictionary can be dropped.
If this is usize::MAX
, the dictionary is mutable.
parent: Option<SharedDict<T>>
Parent dictionary.
When looking up a binding that isn’t present in self
, we traverse this
chain of references. When dropping the dictionary, we decrement the
parent’s ref count.
deallocate: unsafe fn(ptr: NonNull<u8>, layout: Layout)
Implementations§
source§impl<T: 'static> Dictionary<T>
impl<T: 'static> Dictionary<T>
const MUTABLE: usize = 18_446_744_073_709_551_615usize
sourcepub fn layout(size: usize) -> Result<Layout, LayoutError>
pub fn layout(size: usize) -> Result<Layout, LayoutError>
Returns the Layout
that must be allocated for a Dictionary
of the
given size
.
pub(crate) fn add_bi_fastr( &mut self, name: FaStr, bi: fn(_: &mut Forth<T>) -> Result<(), Error>, ) -> Result<(), BumpError>
pub(crate) fn build_entry(&mut self) -> Result<EntryBuilder<'_, T>, BumpError>
pub(crate) fn entries(&self) -> Entries<'_, T> ⓘ
Auto Trait Implementations§
impl<T> !Freeze for Dictionary<T>
impl<T> RefUnwindSafe for Dictionary<T>where
T: RefUnwindSafe,
impl<T> !Send for Dictionary<T>
impl<T> !Sync for Dictionary<T>
impl<T> Unpin for Dictionary<T>
impl<T> UnwindSafe for Dictionary<T>where
T: RefUnwindSafe,
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