DcDocumentNavigator

Struct DcDocumentNavigator 

Source
pub struct DcDocumentNavigator<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> DcDocumentNavigator<'a>

Source

pub fn decode_frame_with_arena<T: DcMixedDecode>( &mut self, stub: &DcFrameStub, arena: &mut DcSyntaxArena<'a>, context: Option<&SharedValueContext>, policy: &DcProjectionPolicy, ) -> Result<T>

Decodes a DcFrameStub into a typed Rust value T using the given SharedValueContext and DcProjectionPolicy, reusing the provided DcSyntaxArena.

Source

pub fn decode_frame<T: DcMixedDecode>( &mut self, stub: &DcFrameStub, context: Option<&SharedValueContext>, policy: &DcProjectionPolicy, ) -> Result<T>

Decodes a DcFrameStub into a typed Rust value T using the given SharedValueContext and DcProjectionPolicy.

Source

pub fn expand_frame( &mut self, stub: &DcFrameStub, arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, ) -> Result<NodeId>

Expands a DcFrameStub into a full CST inside the reusable DcSyntaxArena.

Source

pub fn parse_document_into_arena( &mut self, arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, ) -> Result<()>

Parses all sibling constructs in the active span into arena.

Source

pub fn parse_document_into_arena_with_resolver( &mut self, arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<()>

Parses all sibling constructs in the active span into arena using the provided SyntaxRuleResolver.

Source

pub fn parse_node_into_arena( &mut self, arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, ) -> Result<NodeId>

Parses the next statement or container at the current cursor into arena.

Source

pub fn parse_arena( bytes: &'a [u8], arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, ) -> Result<NodeId>

Parses a single root node from bytes into arena using policy.

Source

pub fn parse_document_arena_with_resolver( bytes: &'a [u8], arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<()>

Parses all document root nodes from bytes into arena using policy and resolver.

Source

pub fn parse_document_arena( bytes: &'a [u8], arena: &mut DcSyntaxArena<'a>, policy: &DcProjectionPolicy, ) -> Result<()>

Parses all document root nodes from bytes into arena using policy.

Source§

impl DcDocumentNavigator<'_>

Source

pub fn eval_pattern<'p, 'r: 'p>( &mut self, pattern: &'p SyntaxPattern, ctx: &mut SyntaxEvalContext<'r>, ) -> Result<bool>

Evaluates a SyntaxPattern starting at the navigator’s current cursor.

If the pattern matches, advances self.cursor past the matched span and returns Ok(true). If the pattern does not match, rewinds self.cursor to its starting offset and returns Ok(false).

Source

pub fn eval_pattern_tokens<'p, 'r: 'p>( &mut self, raw_tokens: &'p [DcShorthand], ctx: &mut SyntaxEvalContext<'r>, ) -> Result<bool>

Evaluates a .Semantic:Pattern &[DcShorthand] token slice from the seed graph, memoizing the decoded SyntaxPattern per (SeedGraphIndex::instance_id, raw_tokens) so repeated evaluations execute without per-step token re-decoding or heap allocations.

Source

pub fn eval_term_single( &mut self, term: &SyntaxTerm, ctx: &mut SyntaxEvalContext<'_>, ) -> Result<bool>

Evaluates a single SyntaxTerm occurrence starting at the current cursor.

Source

pub fn validate_document_strict(&mut self) -> Result<()>

Strictly validates all constructs in the navigator’s active span against the Document Character syntax rules and named-type definitions.

Source

pub fn validate_document(&mut self, policy: &DcProjectionPolicy) -> Result<()>

Validates the active span with the same grammar and resource policy used by arena parsing, without retaining document nodes.

Source

pub fn validate_document_with_resolver( &mut self, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<()>

Validates the active span with the same grammar and resource policy used by arena parsing and the provided resolver, without retaining document nodes.

Source§

impl<'a> DcDocumentNavigator<'a>

Source

pub fn read_tokens_in_span(&mut self, span: DcByteSpan) -> Result<Vec<u128>>

Reads all raw token global IDs within span (preserving escape tokens).

§Errors

Returns an error if span falls on an invalid DcTF or binary boundary.

Source§

impl DcDocumentNavigator<'_>

Source

pub const fn is_v1_encoding(&self) -> bool

Returns true if the navigator is backed by a DcMixed1 (DcUtf) file.

Source

pub fn char_encoded_len(&self, ch: DcChar) -> u64

Returns the encoded byte length of ch in the underlying stream’s Dc encoding (DcUtf for DcMixed1, DcTF for DcMixed2 and in-memory buffers).

Source§

impl<'a> DcDocumentNavigator<'a>

Source

pub fn from_mstr(mstr: &'a DcMstr) -> Self

Creates a navigator over an in-memory DcMstr.

Source

pub fn from_mstr_with_kernel_version( mstr: &'a DcMstr, kernel_version: BootstrapKernelVersion, ) -> Self

Creates a navigator over an in-memory DcMstr, installing kernel_version before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub fn try_from_mstr_with_kernel_version_number( mstr: &'a DcMstr, version: u32, ) -> Result<Self>

Validates an explicit bootstrap kernel version number (1 for V1) and creates a navigator over mstr with that version active before any pin detection or token decoding runs.

§Errors

Returns an error immediately if version is not a supported bootstrap kernel version.

Source

pub fn from_mstr_with_policy( mstr: &'a DcMstr, policy: &DcProjectionPolicy, ) -> Self

Creates a navigator over an in-memory DcMstr using policy.kernel_version and policy.unpinned_fallback_most_recent_node_id before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub fn from_dc_str(text: &'a DcStr) -> Self

Creates a navigator over an in-memory DcStr.

Source

pub fn from_dc_str_with_kernel_version( text: &'a DcStr, kernel_version: BootstrapKernelVersion, ) -> Self

Creates a navigator over an in-memory DcStr, installing kernel_version before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub fn try_from_dc_str_with_kernel_version_number( text: &'a DcStr, version: u32, ) -> Result<Self>

Validates an explicit bootstrap kernel version number (1 for V1) and creates a navigator over text with that version active before any pin detection or token decoding runs.

§Errors

Returns an error immediately if version is not a supported bootstrap kernel version.

Source

pub fn from_dc_str_with_policy( text: &'a DcStr, policy: &DcProjectionPolicy, ) -> Self

Creates a navigator over an in-memory DcStr using policy.kernel_version and policy.unpinned_fallback_most_recent_node_id before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub const fn shared_wasm_task_quota(&self) -> &SharedWasmTaskQuota

Returns the shared crate::converters::wasm::SharedWasmTaskQuota debited across WASM stream splices and helper evaluations on this navigator.

Source

pub fn set_shared_wasm_task_quota(&mut self, shared_quota: SharedWasmTaskQuota)

Replaces the shared crate::converters::wasm::SharedWasmTaskQuota used for WASM stream splices and helper evaluations on this navigator.

Source

pub fn with_shared_wasm_task_quota( self, shared_quota: SharedWasmTaskQuota, ) -> Self

Builder-style method attaching a shared crate::converters::wasm::SharedWasmTaskQuota.

Source

pub const fn kernel_version(&self) -> BootstrapKernelVersion

Returns the active BootstrapKernelVersion governing physical codecs, SeedGraphIndex triple resolution, .Semantic:Pattern operators, and Dc-WASM lowering.

Source

pub fn set_kernel_version(&mut self, version: BootstrapKernelVersion)

Sets the BootstrapKernelVersion for this navigator before document interpretation.

Source

pub fn select_bootstrap_kernel_version( &mut self, version: u32, ) -> Result<BootstrapKernelVersion>

Selects and validates an explicit bootstrap kernel version number (1 for V1) during bootstrap before any document or graph interpretation that depends on it.

§Errors

Returns an error if version is not a supported bootstrap kernel version.

Source

pub const fn document_most_recent_node_id(&self) -> Option<u128>

Returns the System-block most recent node ID (Dc 641 "Global graph system block most recent node ID at time of document creation") active in the current scope, if any.

Source

pub const fn pin_provenance(&self) -> DcPinProvenance

Returns the provenance of the current scope’s System-block snapshot resolution policy.

Source

pub fn diagnostics(&self) -> &[SyntaxDiagnostic]

Returns parse and validation diagnostics recorded on this navigator.

Source

pub fn effective_resolver(&self) -> Arc<DatasetRuleResolver>

Returns the syntax rule resolver pinned for this document (via Dc 641 or explicit override), or the process-wide default_syntax_resolver() when unpinned.

Source

pub fn set_pinned_resolver( &mut self, resolver: Option<Arc<DatasetRuleResolver>>, )

Overrides the pinned syntax rule resolver for this navigator.

Source

pub fn cursor(&self) -> u64

Returns the current stream byte offset.

Source

pub fn peek_token(&mut self) -> Result<Option<DcChar>>

Peeks the next token in the stream without advancing the cursor.

§Errors

Returns an error if reading from the stream fails.

Source

pub fn read_next_token(&mut self) -> Result<Option<DcChar>>

Consumes and returns the next token from the spliced buffer or backend stream.

§Errors

Returns an error if reading from the stream fails.

Source

pub fn push_spliced_tokens<I: IntoIterator<Item = DcChar>>(&mut self, tokens: I)

Splices tokens into the navigator’s append-only stream buffer.

Source

pub fn spliced_tokens(&self) -> &[DcChar]

Returns the active slice of spliced tokens remaining to be consumed.

Source

pub fn splice_stream_invocation( &mut self, evaluator: &dyn DcExpressionEvaluator, resolver: &dyn SyntaxRuleResolver, _policy: &DcProjectionPolicy, ) -> Result<bool>

Evaluates a stream-splicing invocation at the current cursor via evaluator, advances the cursor past the call, and pushes emitted tokens into spliced_tokens.

Source

pub const fn save_checkpoint(&self) -> NavigatorCheckpoint

Saves the current cursor and spliced token slice state into a zero-copy checkpoint.

Source

pub const fn restore_checkpoint(&mut self, checkpoint: NavigatorCheckpoint)

Restores a previously saved checkpoint in O(1) without heap allocation.

Source

pub fn from_dcmm_file(file: File, base_offset: u64) -> Result<Self>

Creates a streaming and seeking navigator over an on-disk .dcmm file starting at base_offset (e.g. 0 for a standalone .dcmm file, or 8 for a .cscjournal after its 8-byte journal magic).

Validates the 21-byte .dcmm magic/UUID header once at base_offset without reading the rest of the file into memory.

Source

pub fn from_dcmm_file_with_kernel_version( file: File, base_offset: u64, kernel_version: BootstrapKernelVersion, ) -> Result<Self>

Creates a streaming and seeking navigator over an on-disk .dcmm file starting at base_offset, installing kernel_version before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub fn try_from_dcmm_file_with_kernel_version_number( file: File, base_offset: u64, version: u32, ) -> Result<Self>

Validates an explicit bootstrap kernel version number (1 for V1) and creates a navigator over an on-disk .dcmm file starting at base_offset with that version active before any pin detection or token decoding runs.

§Errors

Returns an error immediately if version is not a supported bootstrap kernel version or if the .dcmm file header is invalid.

Source

pub fn from_dcmm_file_with_policy( file: File, base_offset: u64, policy: &DcProjectionPolicy, ) -> Result<Self>

Creates a streaming and seeking navigator over an on-disk .dcmm file starting at base_offset using policy.kernel_version and policy.unpinned_fallback_most_recent_node_id before any leading header/pin inspection (Dc 641) or token decoding occurs.

Source

pub const fn position(&self) -> u64

Returns the current byte offset of the navigator cursor.

Source

pub const fn active_span(&self) -> DcByteSpan

Returns the active level’s byte span bounds.

Source

pub fn depth(&self) -> usize

Returns the current nesting depth (0 at document root).

Source

pub fn seek_to_offset(&mut self, offset: u64) -> Result<()>

Seeks the cursor to an arbitrary byte offset within the active level span.

Source

pub fn seek_to_stub(&mut self, stub: &DcFrameStub) -> Result<()>

Seeks the cursor to the start of a previously observed DcFrameStub.

Source

pub fn enter_frame(&mut self, stub: &DcFrameStub) -> Result<()>

Enters the interior of a container DcFrameStub, restricting subsequent Self::next_sibling_stub calls to the container’s children until Self::exit_frame is called.

Source

pub fn exit_frame(&mut self) -> Result<()>

Exits the current container level and restores the enclosing level’s bounds, positioning the cursor at the end of the exited container.

Source

pub fn read_span_bytes(&mut self, span: DcByteSpan) -> Result<Cow<'a, [u8]>>

Reads a raw byte range from the underlying source into a Vec<u8>.

Source

pub fn read_span_as_mstring(&mut self, span: DcByteSpan) -> Result<DcMstring>

Reads a raw byte range from the underlying source and wraps it in a validated DcMstring.

Source

pub fn next_sibling_stub( &mut self, policy: &DcProjectionPolicy, ) -> Result<Option<DcFrameStub>>

Steps across the next sibling statement or container at the current level without allocating an AST for its children.

When backed by a seekable file, binary regions (203..204) are skipped in $O(1)$ via SeekFrom::Current, and checksummed sections (543..544 + 545) are verified incrementally.

Source

pub fn next_sibling_stub_with_resolver( &mut self, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<Option<DcFrameStub>>

Advances to and returns the next sibling DcFrameStub using the specified SyntaxRuleResolver.

Trait Implementations§

Source§

impl DcBinaryResolver for DcDocumentNavigator<'_>

Source§

fn materialize_binary<'a>( &mut self, payload: &BinaryPayloadRef<'a>, ) -> Result<Cow<'a, [u8]>>

Materializes the raw bytes of payload, reading from the backing stream if lazy.
Source§

impl<'a> Debug for DcDocumentNavigator<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T, U> ExactFrom<T> for U
where U: TryFrom<T>,

§

fn exact_from(value: T) -> U

§

impl<T, U> ExactInto<U> for T
where U: ExactFrom<T>,

§

fn exact_into(self) -> U

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 T
where U: OverflowingFrom<T>,

§

fn overflowing_into(self) -> (U, bool)

§

impl<T> Paint for T
where T: ?Sized,

§

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 primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
§

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>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
§

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 bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
§

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 mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
§

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.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
§

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);
§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new [Painted] with a default [Style]. Read more
§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T, U> RoundingInto<U> for T
where U: RoundingFrom<T>,

§

fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, U> SaturatingInto<U> for T
where U: SaturatingFrom<T>,

§

fn saturating_into(self) -> U

§

impl<T> ToDebugString for T
where T: Debug,

§

fn to_debug_string(&self) -> String

Returns the String produced by Ts Debug implementation.

§Examples
use malachite_base::strings::ToDebugString;

assert_eq!([1, 2, 3].to_debug_string(), "[1, 2, 3]");
assert_eq!(
    [vec![2, 3], vec![], vec![4]].to_debug_string(),
    "[[2, 3], [], [4]]"
);
assert_eq!(Some(5).to_debug_string(), "Some(5)");
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T, U> WrappingInto<U> for T
where U: WrappingFrom<T>,

§

fn wrapping_into(self) -> U

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,