pub struct Symbol { /* private fields */ }Expand description
Symbol
Every Symbol has a [SymbolDefinition], a parent and children.
So Symbol is meant as a tree which is used by SymbolTable to store
the resolved symbols by it’s original structure in the source code and by it’s id.
Symbol can be shared as mutable.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn new(def: SymbolDef, parent: Option<Symbol>) -> Self
pub fn new(def: SymbolDef, parent: Option<Symbol>) -> Self
Create new symbol without children.
§Arguments
visibility: Visibility of the symboldef: Symbol definitionparent: Symbol’s parent symbol or none for root
Sourcepub fn new_builtin(builtin: Builtin) -> Symbol
pub fn new_builtin(builtin: Builtin) -> Symbol
Create a symbol node for a built-in.
§Arguments
id: Name of the symbolparameters: Optional parameter listf: The builtin function
Sourcepub fn new_builtin_fn(
name: &'static str,
parameters: impl Iterator<Item = (Identifier, ParameterValue)>,
f: &'static BuiltinFn,
doc: Option<&'static str>,
) -> Symbol
pub fn new_builtin_fn( name: &'static str, parameters: impl Iterator<Item = (Identifier, ParameterValue)>, f: &'static BuiltinFn, doc: Option<&'static str>, ) -> Symbol
New builtin function as symbol.
Source§impl Symbol
impl Symbol
Sourcepub fn try_children<E: Error>(
&self,
f: impl FnMut((&Identifier, &Symbol)) -> Result<(), E>,
) -> Result<(), E>
pub fn try_children<E: Error>( &self, f: impl FnMut((&Identifier, &Symbol)) -> Result<(), E>, ) -> Result<(), E>
Try to apply a FnMut for each child.
Sourcepub fn with_children(&self, f: impl FnMut((&Identifier, &Symbol)))
pub fn with_children(&self, f: impl FnMut((&Identifier, &Symbol)))
Apply a FnMut for each child.
Trait Implementations§
Source§impl FullyQualify for Symbol
impl FullyQualify for Symbol
Source§fn full_name(&self) -> QualifiedName
fn full_name(&self) -> QualifiedName
Get fully qualified name.
Auto Trait Implementations§
impl !Freeze for Symbol
impl !RefUnwindSafe for Symbol
impl !Send for Symbol
impl !Sync for Symbol
impl Unpin for Symbol
impl !UnwindSafe for Symbol
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more