pub struct Stack(/* private fields */);
Expand description
A stack with a list of stack frames.
StackFrame
s can have the following different types:
- source file (bottom of stack)
- modules ( e.g.
mod my_lib { ... }
) - init calls (e.g.
std::geo2d::Circle(radius = 1m)
) - function calls (e.g.
std::print("µcad")
) - bodies (e.g.
{ ... }
)
Implementations§
Source§impl Stack
impl Stack
Sourcepub fn put_local(
&mut self,
id: Option<Identifier>,
symbol: Symbol,
) -> EvalResult<()>
pub fn put_local( &mut self, id: Option<Identifier>, symbol: Symbol, ) -> EvalResult<()>
Put (or overwrite any existing) symbol into the current stack frame.
id
: identifier of the symbol to add/set. The symbol’s internal identifier is used whenNone
.
Sourcepub fn current_module_name(&self) -> QualifiedName
pub fn current_module_name(&self) -> QualifiedName
Get name of current module.
Sourcepub fn current_workbench_name(&self) -> Option<QualifiedName>
pub fn current_workbench_name(&self) -> Option<QualifiedName>
Get name of current workbench.
Sourcepub fn current_frame(&self) -> Option<&StackFrame>
pub fn current_frame(&self) -> Option<&StackFrame>
Return the current stack frame if there is any.
Sourcepub fn pretty_print_call_trace(
&self,
f: &mut dyn Write,
source_by_hash: &impl GetSourceByHash,
) -> Result
pub fn pretty_print_call_trace( &self, f: &mut dyn Write, source_by_hash: &impl GetSourceByHash, ) -> Result
Pretty print call trace.
Trait Implementations§
Source§impl Locals for Stack
impl Locals for Stack
Source§fn current_name(&self) -> QualifiedName
fn current_name(&self) -> QualifiedName
Get name of current workbench or module (might be empty).
Source§fn open(&mut self, frame: StackFrame)
fn open(&mut self, frame: StackFrame)
Don’t use this function directly.
Source§fn set_local_value(&mut self, id: Identifier, value: Value) -> EvalResult<()>
fn set_local_value(&mut self, id: Identifier, value: Value) -> EvalResult<()>
Set/add a named local value to current locals.
Source§fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>
fn get_local_value(&self, id: &Identifier) -> EvalResult<Value>
Get a named local value from locals.
Source§fn get_model(&self) -> EvalResult<Model>
fn get_model(&self) -> EvalResult<Model>
Get a property value from current model.
Source§fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>
fn fetch(&self, id: &Identifier) -> EvalResult<Symbol>
Fetch a local variable from current stack frame.
Auto Trait Implementations§
impl Freeze for Stack
impl !RefUnwindSafe for Stack
impl !Send for Stack
impl !Sync for Stack
impl Unpin for Stack
impl !UnwindSafe for Stack
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> 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