Struct nu_protocol::engine::StateWorkingSet
source · [−]pub struct StateWorkingSet<'a> {
pub permanent_state: &'a EngineState,
pub delta: StateDelta,
pub external_commands: Vec<Vec<u8>>,
}Expand description
A temporary extension to the global state. This handles bridging between the global state and the additional declarations and scope changes that are not yet part of the global scope.
This working set is created by the parser as a way of handling declarations and scope changes that may later be merged or dropped (and not merged) depending on the needs of the code calling the parser.
Fields
permanent_state: &'a EngineStatedelta: StateDeltaexternal_commands: Vec<Vec<u8>>Implementations
sourceimpl<'a> StateWorkingSet<'a>
impl<'a> StateWorkingSet<'a>
pub fn new(permanent_state: &'a EngineState) -> Self
pub fn num_files(&self) -> usize
pub fn num_decls(&self) -> usize
pub fn num_aliases(&self) -> usize
pub fn num_blocks(&self) -> usize
pub fn num_overlays(&self) -> usize
pub fn add_decl(&mut self, decl: Box<dyn Command>) -> DeclId
pub fn use_decls(&mut self, decls: Vec<(Vec<u8>, DeclId)>)
pub fn use_aliases(&mut self, aliases: Vec<(Vec<u8>, AliasId)>)
pub fn add_predecl(&mut self, decl: Box<dyn Command>) -> Option<DeclId>
pub fn merge_predecl(&mut self, name: &[u8]) -> Option<DeclId>
pub fn hide_decl(&mut self, name: &[u8]) -> Option<DeclId>
pub fn use_alias(&mut self, alias_id: &AliasId)
pub fn hide_alias(&mut self, name: &[u8]) -> Option<AliasId>
pub fn hide_decls(&mut self, decls: &[Vec<u8>])
pub fn hide_aliases(&mut self, aliases: &[Vec<u8>])
pub fn add_block(&mut self, block: Block) -> BlockId
pub fn add_env_var(&mut self, name_span: Span, block: Block) -> BlockId
pub fn add_overlay(&mut self, name: &str, overlay: Overlay) -> OverlayId
pub fn next_span_start(&self) -> usize
pub fn global_span_offset(&self) -> usize
pub fn files(&'a self) -> impl Iterator<Item = &(String, usize, usize)>
pub fn get_filename(&self, file_id: usize) -> String
pub fn get_file_source(&self, file_id: usize) -> String
pub fn add_file(&mut self, filename: String, contents: &[u8]) -> usize
pub fn get_span_contents(&self, span: Span) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn enter_scope(&mut self)
pub fn exit_scope(&mut self)
pub fn find_predecl(&self, name: &[u8]) -> Option<DeclId>
pub fn find_decl(&self, name: &[u8]) -> Option<DeclId>
pub fn find_alias(&self, name: &[u8]) -> Option<AliasId>
pub fn find_overlay(&self, name: &[u8]) -> Option<OverlayId>
pub fn contains_decl_partial_match(&self, name: &[u8]) -> bool
pub fn next_var_id(&self) -> VarId
pub fn find_variable(&self, name: &[u8]) -> Option<VarId>
pub fn add_variable(&mut self, name: Vec<u8>, span: Span, ty: Type) -> VarId
pub fn add_alias(&mut self, name: Vec<u8>, replacement: Vec<Span>)
pub fn get_cwd(&self) -> String
pub fn get_env(&self, name: &str) -> Option<&Value>
pub fn set_variable_type(&mut self, var_id: VarId, ty: Type)
pub fn get_variable(&self, var_id: VarId) -> &Variable
pub fn get_decl(&self, decl_id: DeclId) -> &Box<dyn Command>
pub fn get_decl_mut(&mut self, decl_id: DeclId) -> &mut Box<dyn Command>
pub fn get_alias(&self, alias_id: AliasId) -> &[Span]
pub fn find_commands_by_prefix(
&self,
name: &[u8]
) -> Vec<(Vec<u8>, Option<String>)>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn find_aliases_by_prefix(&self, name: &[u8]) -> Vec<Vec<u8>>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
pub fn get_block(&self, block_id: BlockId) -> &Block
pub fn get_overlay(&self, overlay_id: OverlayId) -> &Overlay
pub fn get_block_mut(&mut self, block_id: BlockId) -> &mut Block
pub fn render(self) -> StateDelta
Trait Implementations
sourceimpl<'a> SourceCode for &StateWorkingSet<'a>
impl<'a> SourceCode for &StateWorkingSet<'a>
sourcefn read_span<'b>(
&'b self,
span: &SourceSpan,
context_lines_before: usize,
context_lines_after: usize
) -> Result<Box<dyn SpanContents<'_> + 'b>, MietteError>
fn read_span<'b>(
&'b self,
span: &SourceSpan,
context_lines_before: usize,
context_lines_after: usize
) -> Result<Box<dyn SpanContents<'_> + 'b>, MietteError>
Read the bytes for a specific span from this SourceCode, keeping a certain number of lines before and after the span as context. Read more
Auto Trait Implementations
impl<'a> !RefUnwindSafe for StateWorkingSet<'a>
impl<'a> Send for StateWorkingSet<'a>
impl<'a> Sync for StateWorkingSet<'a>
impl<'a> Unpin for StateWorkingSet<'a>
impl<'a> !UnwindSafe for StateWorkingSet<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more