pub struct EiteState {Show 24 fields
pub debug_level: i32,
pub env_preferred_format: String,
pub env_char_encoding: String,
pub env_terminal_type: String,
pub env_language: String,
pub env_locale_config: String,
pub env_code_language: String,
pub env_resolution_w: i32,
pub env_resolution_h: i32,
pub document_exec_data: Vec<String>,
pub document_exec_symbol_index: Vec<String>,
pub document_exec_ptrs: Vec<String>,
pub document_exec_frames: Vec<String>,
pub document_exec_events: Vec<String>,
pub document_exec_logs: Vec<String>,
pub document_exec_settings: Vec<String>,
pub tests_passed: u32,
pub tests_failed: u32,
pub tests_total: u32,
pub import_settings: Vec<String>,
pub export_settings: Vec<String>,
pub import_deferred_settings_stack: Vec<String>,
pub export_deferred_settings_stack: Vec<String>,
pub storage_cfg: Vec<String>,
}Expand description
Environment / shared state. In JS this lived on the global object with many independent keys; here we consolidate into a struct.
Fields§
§debug_level: i32§env_preferred_format: String§env_char_encoding: String§env_terminal_type: String§env_language: String§env_locale_config: String§env_code_language: String§env_resolution_w: i32§env_resolution_h: i32§document_exec_data: Vec<String>§document_exec_symbol_index: Vec<String>§document_exec_ptrs: Vec<String>§document_exec_frames: Vec<String>§document_exec_events: Vec<String>§document_exec_logs: Vec<String>§document_exec_settings: Vec<String>§tests_passed: u32§tests_failed: u32§tests_total: u32§import_settings: Vec<String>§export_settings: Vec<String>§import_deferred_settings_stack: Vec<String>§export_deferred_settings_stack: Vec<String>§storage_cfg: Vec<String>Implementations§
Source§impl EiteState
impl EiteState
pub fn new() -> Self
Sourcepub fn prepare_document_exec(&mut self, contents: &[u32]) -> usize
pub fn prepare_document_exec(&mut self, contents: &[u32]) -> usize
Prepare a new document execution context. Returns exec ID.
pub fn is_exec_id(&self, exec_id: usize) -> bool
Sourcepub fn get_exec_settings(&self, exec_id: usize) -> Result<Vec<String>>
pub fn get_exec_settings(&self, exec_id: usize) -> Result<Vec<String>>
NOTE: Minimal kv split: split on ‘,’ dropping empty trailing segments.
Sourcepub fn set_exec_settings(&mut self, exec_id: usize, kv: &[String]) -> Result<()>
pub fn set_exec_settings(&mut self, exec_id: usize, kv: &[String]) -> Result<()>
Replace full settings (joined with trailing comma for symmetry with original usage).
pub fn get_exec_ptrs(&self, exec_id: usize) -> Result<Vec<String>>
pub fn set_exec_ptrs(&mut self, exec_id: usize, ptrs: &[String]) -> Result<()>
fn parse_ptr(val: &str) -> u32
pub fn get_current_exec_ptr_pos(&self, exec_id: usize) -> Result<u32>
pub fn set_exec_ptr_pos(&mut self, exec_id: usize, new_pos: u32) -> Result<()>
pub fn incr_exec_ptr_pos(&mut self, exec_id: usize) -> Result<()>
pub fn get_next_level_exec_ptr_pos(&self, exec_id: usize) -> Result<u32>
pub fn get_current_exec_data(&self, exec_id: usize) -> Result<Vec<u32>>
pub fn get_current_exec_frame(&self, exec_id: usize) -> Result<Vec<u32>>
Sourcepub fn get_exec_option(
&self,
exec_id: usize,
key: &str,
) -> Result<Option<String>>
pub fn get_exec_option( &self, exec_id: usize, key: &str, ) -> Result<Option<String>>
Retrieve a single exec option (key -> value) from settings KV.
Sourcepub fn set_exec_option(
&mut self,
exec_id: usize,
key: &str,
val: &str,
) -> Result<()>
pub fn set_exec_option( &mut self, exec_id: usize, key: &str, val: &str, ) -> Result<()>
Set (or insert) an exec option key=value pair.
Sourcepub fn set_exec_frame(&mut self, exec_id: usize, frame: &[u32]) -> Result<()>
pub fn set_exec_frame(&mut self, exec_id: usize, frame: &[u32]) -> Result<()>
Overwrite current frame output.
pub fn get_env_preferred_format(&self) -> &str
Trait Implementations§
Auto Trait Implementations§
impl Freeze for EiteState
impl RefUnwindSafe for EiteState
impl Send for EiteState
impl Sync for EiteState
impl Unpin for EiteState
impl UnwindSafe for EiteState
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
impl<T, U> ExactFrom<T> for Uwhere
U: TryFrom<T>,
fn exact_from(value: T) -> U
§impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
impl<T, U> ExactInto<U> for Twhere
U: ExactFrom<T>,
fn exact_into(self) -> U
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more§impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
impl<T, U> OverflowingInto<U> for Twhere
U: OverflowingFrom<T>,
fn overflowing_into(self) -> (U, bool)
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);