Struct brane_ast::state::TableState
source · pub struct TableState {
pub funcs: Vec<FunctionState>,
pub tasks: Vec<TaskState>,
pub classes: Vec<ClassState>,
pub vars: Vec<VarState>,
pub results: HashMap<String, String>,
}
Expand description
Defines a ‘TableState’, which is the CompileState’s notion of a symbol table.
Fields§
§funcs: Vec<FunctionState>
The functions that are kept for next compilation junks
tasks: Vec<TaskState>
The tasks that are kept for next compilation junks
classes: Vec<ClassState>
The functions that are kept for next compilation junks
vars: Vec<VarState>
The functions that are kept for next compilation junks
results: HashMap<String, String>
The list of results introduced in this workflow.
Implementations§
source§impl TableState
impl TableState
sourcepub fn new() -> Self
pub fn new() -> Self
Constructor for the TableState which initializes it with the builtin’s only.
We assume this is a toplevel table, so we assume no functions, tasks, classes or variables have been defined that this table needs to be aware of.
§Returns
A new instance of the TableState.
sourcepub fn empty() -> Self
pub fn empty() -> Self
Constructor for the TableState that doesn’t even initialize it to builtins.
§Returns
A new, completely empty instance of the TableState.
sourcepub fn none() -> Self
pub fn none() -> Self
Constructor for the TableState that initializes it to not really a valid state (but kinda).
This is useful if you just need a placeholder for a table but know that the function body in question is never executed anyway (e.g.., builtins or external functions).
§Returns
A new TableState instance that will keep the compiler happy but will probably result into runtime crashes once used (pay attention to overflows).
sourcepub fn inject(&self, st: &mut RefMut<'_, SymbolTable>)
pub fn inject(&self, st: &mut RefMut<'_, SymbolTable>)
Injects the TableState into the given SymbolTable. The entries will already have indices properly resolved.
Only global definitions are injected. Any nested ones (except for class stuff) is irrelevant due to them never being accessed in future workflow snippets.
§Arguments
st
: The (mutable) borrow to the symbol table where we will inject everything.
§Returns
Nothing, but does alter the given symbol table to insert everything.
sourcepub fn func(&self, id: usize) -> &FunctionState
pub fn func(&self, id: usize) -> &FunctionState
Returns the function with the given index, if any.
§Arguments
id
: The ID/index of the function to get the compile state of.
§Returns
A reference to the corresponding FunctionState
.
§Panics
This function may panic if id
is out-of-bounds.
sourcepub fn class(&self, id: usize) -> &ClassState
pub fn class(&self, id: usize) -> &ClassState
Returns the class with the given index, if any.
§Arguments
id
: The ID/index of the class to get the compile state of.
§Returns
A reference to the corresponding ClassState
.
§Panics
This function may panic if id
is out-of-bounds.
Trait Implementations§
source§impl Clone for TableState
impl Clone for TableState
source§fn clone(&self) -> TableState
fn clone(&self) -> TableState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TableState
impl Debug for TableState
source§impl Default for TableState
impl Default for TableState
source§impl From<&TableState> for SymTable
impl From<&TableState> for SymTable
source§fn from(value: &TableState) -> Self
fn from(value: &TableState) -> Self
source§impl From<TableState> for SymTable
impl From<TableState> for SymTable
source§fn from(value: TableState) -> Self
fn from(value: TableState) -> Self
Auto Trait Implementations§
impl Freeze for TableState
impl RefUnwindSafe for TableState
impl Send for TableState
impl Sync for TableState
impl Unpin for TableState
impl UnwindSafe for TableState
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request