pub struct RuntimeUse { /* private fields */ }Expand description
Per-module accumulator of conditional runtime-helper references.
One instance per emitted module (it lives on that module’s emission context), so flags never leak between files.
Implementations§
Source§impl RuntimeUse
impl RuntimeUse
Sourcepub fn set_plain_json(&self, on: bool)
pub fn set_plain_json(&self, on: bool)
Record that the project has a plain-JSON route (#2858).
Sourcepub fn plain_json(&self) -> bool
pub fn plain_json(&self) -> bool
Whether the Option encoders carry the plain-JSON branch (#2858).
Sourcepub fn note_bytes(&self)
pub fn note_bytes(&self)
Record that the module references the Bytes runtime helpers.
Sourcepub fn note_virtual_time(&self)
pub fn note_virtual_time(&self)
Record that the test module runs on virtual time (#2683).
Sourcepub fn virtual_time(&self) -> bool
pub fn virtual_time(&self) -> bool
Whether the test module runs on virtual time (#2683).
Sourcepub fn note_detach(&self)
pub fn note_detach(&self)
Record that the module references the detach reporter (#3437).
Record that a result method names the bynk Cookie type (#3277).
Whether the module must import the Cookie type (#3277).
Sourcepub fn note_cmp(&self, name: &'static str)
pub fn note_cmp(&self, name: &'static str)
Record that the module references the comparator helper name
(compare.ts; constrained-generics slice 1).
Sourcepub fn note_key(&self, name: &'static str)
pub fn note_key(&self, name: &'static str)
Record that the module references the key helper name (keys.ts;
constrained-generics slice 2). They share the comparator group’s import
run, which is a generic set of runtime names.
Sourcepub fn note_decimal(&self, name: &'static str)
pub fn note_decimal(&self, name: &'static str)
Record that the module references the Decimal runtime helper name
(decimal.ts, #2622). Rides the same set as the comparator helpers, so
every import site already emits it.
Sourcepub fn cmp_imports(&self) -> String
pub fn cmp_imports(&self) -> String
The comparator helpers to import, as a ", a, b" run (empty when the
module uses none), in the shape the other conditional groups take.
Sourcepub fn set_json_codec_qual(&self, qual: HashMap<String, String>)
pub fn set_json_codec_qual(&self, qual: HashMap<String, String>)
#917: set once, up front, before any body lowers — the type-only namespace qualifier a test-scaffold module’s codec calls render foreign named types through. A no-op default (empty map) everywhere else.
Sourcepub fn json_codec_qual(&self) -> Ref<'_, HashMap<String, String>>
pub fn json_codec_qual(&self) -> Ref<'_, HashMap<String, String>>
The namespace qualifier a test-scaffold module’s codec calls render foreign named types through (empty on every other emission path).
Sourcepub fn note_json_codec_root(&self, t: TyId)
pub fn note_json_codec_root(&self, t: TyId)
#917: record a Json.decode[T]/Json.encode target type a test-scaffold
body reached for, so the module that spliced it in can generate the codec
helper its delegating call needs.
Sourcepub fn note_test_event_service(&self, service: &str)
pub fn note_test_event_service(&self, service: &str)
#2052: record that a test-scaffold body delivers an event to service.
Sourcepub fn test_event_services(&self) -> Vec<String>
pub fn test_event_services(&self) -> Vec<String>
#2052: the services a test-scaffold module delivers events to, sorted.
Sourcepub fn json_codec_roots_len(&self) -> usize
pub fn json_codec_roots_len(&self) -> usize
#3111: how many codec roots have been noted so far; a runner records it
before lowering and reads back what it added with
json_codec_roots_since.
Sourcepub fn json_codec_roots_since(&self, mark: usize) -> Vec<TyId>
pub fn json_codec_roots_since(&self, mark: usize) -> Vec<TyId>
#3111: the codec roots noted at or after mark (not drained).
Sourcepub fn note_internal_fault(&self, span: Span, what: String)
pub fn note_internal_fault(&self, span: Span, what: String)
1A.34: record a checker fact lowering needed and did not find.
Sourcepub fn take_faults(&self) -> Vec<InternalFault>
pub fn take_faults(&self) -> Vec<InternalFault>
1A.34: drain the recorded faults, once the unit has been lowered. Empty for every program the checker passed.
Sourcepub fn take_json_codec_roots(&self) -> Vec<TyId>
pub fn take_json_codec_roots(&self) -> Vec<TyId>
Drain the accumulated Json codec roots — called once, after every
case/property/stub body in the module has lowered.
Trait Implementations§
Source§impl Default for RuntimeUse
impl Default for RuntimeUse
Source§fn default() -> RuntimeUse
fn default() -> RuntimeUse
Auto Trait Implementations§
impl !Freeze for RuntimeUse
impl !RefUnwindSafe for RuntimeUse
impl Send for RuntimeUse
impl !Sync for RuntimeUse
impl Unpin for RuntimeUse
impl UnsafeUnpin for RuntimeUse
impl UnwindSafe for RuntimeUse
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
§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);