pub struct LocalTable { /* private fields */ }Expand description
Flat ordered list of all variable declarations within a script.
entries is pub(crate) rather than pub so the storage shape
(currently a Vec<LocalEntry>) can change without breaking external
consumers. Read access from inside the crate goes through
entries(); mutations go through push_param / push_local.
Implementations§
Source§impl LocalTable
impl LocalTable
pub fn new() -> Self
Sourcepub fn entries(&self) -> &[LocalEntry]
pub fn entries(&self) -> &[LocalEntry]
Read-only view of the ordered local entries. Use this for iteration.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Release spare capacity once the table is final (post-codegen).
pub fn push_param(&mut self, name: String, param_type: Type) -> i32
pub fn push_local( &mut self, name: String, var_type: Type, is_array: bool, ) -> i32
Sourcepub fn get_variable_id(&self, index: usize) -> i32
pub fn get_variable_id(&self, index: usize) -> i32
Matches TS getVariableId for an existing entry by index.
Sourcepub fn get_local_count(&self, base: BaseVarType) -> u16
pub fn get_local_count(&self, base: BaseVarType) -> u16
Matches TS getLocalCount.
Sourcepub fn get_param_count(&self, base: BaseVarType) -> u16
pub fn get_param_count(&self, base: BaseVarType) -> u16
Matches TS getParameterCount.
Trait Implementations§
Source§impl Clone for LocalTable
impl Clone for LocalTable
Source§impl Debug for LocalTable
impl Debug for LocalTable
Auto Trait Implementations§
impl Forget for LocalTable
impl Freeze for LocalTable
impl Move for LocalTable
impl RefUnwindSafe for LocalTable
impl Send for LocalTable
impl Sync for LocalTable
impl Unpin for LocalTable
impl UnsafeUnpin for LocalTable
impl UnwindSafe for LocalTable
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