pub struct CompilationContext<'a> {
pub index: Cell<usize>,
pub inserted_value_index: Cell<usize>,
pub buffer: RefCell<Vec<u8>>,
pub inserted_values: RefCell<&'a [&'a ValueContainer]>,
pub has_non_static_value: RefCell<bool>,
pub is_end_of_source_text: bool,
/* private fields */
}Expand description
compilation context, created for each compiler call, even if compiling a script for the same scope
Fields§
§index: Cell<usize>§inserted_value_index: Cell<usize>§buffer: RefCell<Vec<u8>>§inserted_values: RefCell<&'a [&'a ValueContainer]>§has_non_static_value: RefCell<bool>this flag is set to true if any non-static value is encountered
is_end_of_source_text: boolSet to true if no further source text is expected to be compiled. Example: for a REPL, this is set to false
Implementations§
Source§impl<'a> CompilationContext<'a>
impl<'a> CompilationContext<'a>
pub fn new( buffer: RefCell<Vec<u8>>, inserted_values: &'a [&'a ValueContainer], is_end_of_source_text: bool, ) -> Self
pub fn external_slots(&self) -> Vec<VirtualSlot>
Sourcepub fn get_slot_byte_indices(&self, match_externals: bool) -> Vec<Vec<u32>>
pub fn get_slot_byte_indices(&self, match_externals: bool) -> Vec<Vec<u32>>
Gets all slots for either local or external slots depending on the value of external
pub fn remap_virtual_slots(&self)
pub fn insert_virtual_slot_address(&self, virtual_slot: VirtualSlot)
pub fn insert_value_container(&self, value_container: &ValueContainer)
pub fn insert_value(&self, value: &Value)
pub fn insert_boolean(&self, boolean: bool)
pub fn insert_text(&self, string: &str)
pub fn insert_key_value_pair( &self, key: &ValueContainer, value: &ValueContainer, )
pub fn insert_struct_key_value_pair(&self, key: String, value: &ValueContainer)
pub fn insert_key_string(&self, key_string: &str)
pub fn insert_encoded_decimal(&self, decimal: &TypedDecimal)
pub fn insert_typed_decimal(&self, decimal: &TypedDecimal)
pub fn insert_float32(&self, float32: f32)
pub fn insert_float64(&self, float64: f64)
pub fn insert_endpoint(&self, endpoint: &Endpoint)
pub fn insert_big_integer(&self, integer: &Integer)
Sourcepub fn insert_encoded_integer(&self, integer: &TypedInteger)
pub fn insert_encoded_integer(&self, integer: &TypedInteger)
Inserts an encoded integer without explicit type casts
Sourcepub fn insert_typed_integer(&self, integer: &TypedInteger)
pub fn insert_typed_integer(&self, integer: &TypedInteger)
Inserts a typed integer with explicit type casts
pub fn insert_decimal(&self, decimal: &Decimal)
pub fn insert_float_as_i16(&self, int: i16)
pub fn insert_float_as_i32(&self, int: i32)
pub fn insert_i8(&self, int8: i8)
pub fn insert_i16(&self, int16: i16)
pub fn insert_i32(&self, int32: i32)
pub fn insert_i64(&self, int64: i64)
pub fn insert_i128(&self, int128: i128)
pub fn insert_u8(&self, uint8: u8)
pub fn insert_u16(&self, uint16: u16)
pub fn insert_u32(&self, uint32: u32)
pub fn insert_u64(&self, uint64: u64)
pub fn insert_u128(&self, uint128: u128)
pub fn append_u8(&self, u8: u8)
pub fn append_u32(&self, u32: u32)
pub fn set_u32_at_index(&self, u32: u32, index: usize)
pub fn append_i8(&self, i8: i8)
pub fn append_i16(&self, i16: i16)
pub fn append_i32(&self, i32: i32)
pub fn append_i64(&self, i64: i64)
pub fn append_i128(&self, i128: i128)
pub fn append_u128(&self, u128: u128)
pub fn append_f32(&self, f32: f32)
pub fn append_f64(&self, f64: f64)
pub fn append_string_utf8(&self, string: &str)
pub fn append_buffer(&self, buffer: &[u8])
pub fn insert_get_ref(&self, address: PointerAddress)
pub fn mark_has_non_static_value(&self)
pub fn append_instruction_code(&self, code: InstructionCode)
Source§impl<'a> CompilationContext<'a>
Compilation functions for type expressions.
impl<'a> CompilationContext<'a>
Compilation functions for type expressions.
pub fn append_type_instruction_code(&self, code: TypeSpaceInstructionCode)
pub fn insert_type_literal_integer(&self, integer: &Integer)
Auto Trait Implementations§
impl<'a> !Freeze for CompilationContext<'a>
impl<'a> !RefUnwindSafe for CompilationContext<'a>
impl<'a> !Send for CompilationContext<'a>
impl<'a> !Sync for CompilationContext<'a>
impl<'a> Unpin for CompilationContext<'a>
impl<'a> !UnwindSafe for CompilationContext<'a>
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
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> 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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§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();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§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();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§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();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§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();Source§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.Source§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);