Skip to main content

EntryMut

Struct EntryMut 

Source
pub struct EntryMut<'t> {
    table: &'t mut Table,
    id: Handle,
}
Expand description

A mutable, object-like entry in a Table.

Entry wraps a Table and a Handle, and provides an ergonomic interface for querying information about the state of the node at that Handle.

Its immutable counterpart, Entry, provides a similar interface for querying the state of the Table, which may be shared among multiple Entries.

Fields§

§table: &'t mut Table§id: Handle

Implementations§

Source§

impl<'t> EntryMut<'t>

Source

pub fn new(table: &'t mut Table, id: Handle) -> Self

Constructs a new EntryMut from a &mut Table and a Handle.

Source

pub const fn id(&self) -> Handle

Gets the Handle associated with this Entry

Source

pub const fn inner(&'t self) -> &'t Table

Gets the Table associated with this Entry

Source

pub fn kind(&self) -> Option<&NodeKind>

Gets the NodeKind of this Entry in the Table

Source

pub const fn root(&self) -> Entry<'_>

Gets the Entry of the root node in the Table

Source

pub fn children(&self) -> Option<&SymMap<Handle>>

Gets the children of this node

Source

pub fn lazy_imports(&self) -> Option<&SymMap<Path>>

Gets the lazy-imports list for this node

Source

pub fn glob_imports(&self) -> Option<&[Path]>

Gets the glob-imports list for this node

Source

pub fn meta(&self) -> Option<&[Expr]>

Gets the meta-Expr list for this node

Source

pub fn name(&self) -> Option<Sym>

Gets an identifying Symbol for this node, if possible

Source

pub fn ty(&self) -> Option<&TypeKind>

Gets the TypeKind of this EntryMut

Source

pub fn inner_mut(&mut self) -> &mut Table

Reborrows the inner Table reference

Source

pub fn as_ref(&self) -> Entry<'_>

Cheaply constructs an Entry from this EntryMut

Source

pub fn evaluate<Out>( &mut self, ty: &impl TypeExpression<Out>, ) -> Result<Out, Error>

Evaluates a TypeExpression in this entry’s context

Source

pub fn categorize(&mut self) -> Result<(), Error>

Calls categorize on this node in the table

Source

pub fn with_id(&mut self, parent: Handle) -> EntryMut<'_>

Constructs a new Handle with the provided parent Handle

Source

pub fn nav(&mut self, path: &[Sym]) -> Option<EntryMut<'_>>

Navigates to another EntryMut, reborrowing the table.

Source

pub fn new_entry(&mut self, kind: NodeKind) -> EntryMut<'_>

Constructs a new node with the given NodeKind, and returns its EntryMut.

Source

pub fn add_child(&mut self, name: Sym, child: Handle) -> Option<Handle>

Adds an existing node as a child with the given name.

If that name is already taken, its previous Handle is returned.

Source

pub fn add_import(&mut self, name: Sym, path: Path)

Adds a lazy-import edge from name to path

Source

pub fn add_glob(&mut self, path: Path)

Adds a glob-import edge to path.

Glob imports act as secondary (tertiary, etc.) parent edges, which are always transparent. They are checked in reverse order, giving later glob imports precedence over earlier ones.

Source

pub fn set_name(&mut self, name: Sym) -> Option<Sym>

Sets the name of this EntryMut.

Source

pub fn set_ty(&mut self, kind: TypeKind) -> Option<TypeKind>

Sets the TypeKind of this EntryMut

Source

pub fn set_meta(&mut self, meta: Vec<Expr>)

Appends a list of Exprs to this EntryMut’s meta.

Source

pub fn add_meta(&mut self, meta: Expr)

Adds a single Expr to this EntryMut’s meta

Source

pub fn set_impl_target(&mut self, target: Handle) -> Option<Handle>

Sets the impl target to target

Source

pub fn mark_unchecked(&mut self)

Marks this EntryMut as unchecked.

Source

pub fn mark_impl_item(&mut self)

Marks this EntryMut as an impl item

Source

pub fn mark_lang_item(&mut self, lang_item: &'static str)

Marks this EntryMut as a lang item

Trait Implementations§

Source§

impl<'t> Debug for EntryMut<'t>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'t> Freeze for EntryMut<'t>

§

impl<'t> RefUnwindSafe for EntryMut<'t>

§

impl<'t> Send for EntryMut<'t>

§

impl<'t> Sync for EntryMut<'t>

§

impl<'t> Unpin for EntryMut<'t>

§

impl<'t> !UnwindSafe for EntryMut<'t>

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