pub struct DcMstring { /* private fields */ }Expand description
An owned, growable buffer containing valid DcMixed (Dc mixed mode) format data (.dcmm). Analogous to DcString and Rust’s String.
Implementations§
Source§impl DcMstring
impl DcMstring
Sourcepub fn writer(&mut self) -> DcWriter<'_> ⓘ
pub fn writer(&mut self) -> DcWriter<'_> ⓘ
Appends through the same encoder used for direct streaming output.
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty DcMstring initialized with the standard 21-byte header.
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Creates an empty DcMstring with pre-allocated capacity in bytes.
Sourcepub fn from_bytes(bytes: Vec<u8>) -> Result<Self, DcMixedError>
pub fn from_bytes(bytes: Vec<u8>) -> Result<Self, DcMixedError>
Validates an owned Vec<u8> as DcMixed and wraps it in DcMstring.
§Errors
Returns DcMixedError if the bytes do not conform to the DcMixed specification.
Sourcepub fn from_bytes_with_policy(
bytes: Vec<u8>,
policy: &DcProjectionPolicy,
) -> Result<Self, DcMixedError>
pub fn from_bytes_with_policy( bytes: Vec<u8>, policy: &DcProjectionPolicy, ) -> Result<Self, DcMixedError>
Validates an owned Vec<u8> as DcMixed using policy and wraps it in DcMstring.
§Errors
Returns DcMixedError if the bytes do not conform to the DcMixed specification.
Sourcepub fn from_slice(bytes: &[u8]) -> Result<Self, DcMixedError>
pub fn from_slice(bytes: &[u8]) -> Result<Self, DcMixedError>
Validates a borrowed &[u8] as DcMixed and creates an owned DcMstring.
§Errors
Returns DcMixedError if the slice does not conform to the DcMixed specification.
Sourcepub fn from_slice_with_policy(
bytes: &[u8],
policy: &DcProjectionPolicy,
) -> Result<Self, DcMixedError>
pub fn from_slice_with_policy( bytes: &[u8], policy: &DcProjectionPolicy, ) -> Result<Self, DcMixedError>
Validates a borrowed &[u8] as DcMixed using policy and creates an owned DcMstring.
§Errors
Returns DcMixedError if the slice does not conform to the DcMixed specification.
Sourcepub const unsafe fn from_bytes_unchecked(bytes: Vec<u8>) -> Self
pub const unsafe fn from_bytes_unchecked(bytes: Vec<u8>) -> Self
Wraps a Vec<u8> as DcMstring without validation.
§Safety
Caller must ensure bytes contains valid DcMixed format data.
Sourcepub fn from_dc_str(s: &DcStr) -> Result<Self>
pub fn from_dc_str(s: &DcStr) -> Result<Self>
Converts a standard DcStr (DcUtf) into a DcMstring document.
Dc 203 regions contain an optional type, decoded byte length, checksum, and base64 payload. They are stored as direct type-2 binary runs.
§Errors
Returns an error for malformed encapsulations or invalid lengths and checksums. Base64 spelling and framing may be normalized.
Sourcepub fn from_dc_str_with_policy(
s: &DcStr,
policy: &DcProjectionPolicy,
) -> Result<Self>
pub fn from_dc_str_with_policy( s: &DcStr, policy: &DcProjectionPolicy, ) -> Result<Self>
Converts a standard DcStr (DcUtf) into a DcMstring document using
the provided crate::DcProjectionPolicy.
Sourcepub fn from_dc_str_with_policy_and_resolver(
s: &DcStr,
policy: &DcProjectionPolicy,
resolver: &dyn SyntaxRuleResolver,
) -> Result<Self>
pub fn from_dc_str_with_policy_and_resolver( s: &DcStr, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<Self>
Converts a standard DcStr (DcUtf) into a DcMstring document using
the provided crate::DcProjectionPolicy and crate::SyntaxRuleResolver.
Sourcepub fn from_dc_string(s: &DcString) -> Result<Self>
pub fn from_dc_string(s: &DcString) -> Result<Self>
Converts a standard DcString (DcUtf) into a DcMstring document.
Sourcepub fn from_dc_string_with_policy(
s: &DcString,
policy: &DcProjectionPolicy,
) -> Result<Self>
pub fn from_dc_string_with_policy( s: &DcString, policy: &DcProjectionPolicy, ) -> Result<Self>
Converts a standard DcString (DcUtf) into a DcMstring document using
the provided crate::DcProjectionPolicy.
Sourcepub fn to_dc_string(&self) -> Result<DcString>
pub fn to_dc_string(&self) -> Result<DcString>
Converts this DcMstring into a standard DcString (DcUtf) representation.
Sourcepub fn to_dc_string_with_policy(
&self,
policy: &DcProjectionPolicy,
) -> Result<DcString>
pub fn to_dc_string_with_policy( &self, policy: &DcProjectionPolicy, ) -> Result<DcString>
Converts this DcMstring into a standard DcString (DcUtf) representation
using the provided crate::DcProjectionPolicy.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consumes this DcMstring and returns the underlying byte vector.
Sourcepub fn push_dc_str(&mut self, s: &DcStr)
pub fn push_dc_str(&mut self, s: &DcStr)
Appends a DcStr slice as text.
Sourcepub fn push_char(&mut self, ch: impl Into<DcChar>)
pub fn push_char(&mut self, ch: impl Into<DcChar>)
Appends a single character (DcChar or char) as text.
Sourcepub fn push_binary(&mut self, data: &[u8])
pub fn push_binary(&mut self, data: &[u8])
Appends a type-2 binary payload with an empty metadata block.
Sourcepub fn push_binary_with_metadata(
&mut self,
data: &[u8],
metadata: &DcStr,
) -> Result<()>
pub fn push_binary_with_metadata( &mut self, data: &[u8], metadata: &DcStr, ) -> Result<()>
Appends binary data with [type]? [checksum]? DcUtf metadata.
§Errors
Returns an error for invalid metadata or a mismatched checksum.
Sourcepub fn push_binary_with_metadata_and_policy(
&mut self,
data: &[u8],
metadata: &DcStr,
policy: &DcProjectionPolicy,
) -> Result<()>
pub fn push_binary_with_metadata_and_policy( &mut self, data: &[u8], metadata: &DcStr, policy: &DcProjectionPolicy, ) -> Result<()>
Appends binary data with [type]? [checksum]? DcUtf metadata using the
provided crate::DcProjectionPolicy.
Sourcepub fn push_binary_with_metadata_policy_and_resolver(
&mut self,
data: &[u8],
metadata: &DcStr,
policy: &DcProjectionPolicy,
resolver: &dyn SyntaxRuleResolver,
) -> Result<()>
pub fn push_binary_with_metadata_policy_and_resolver( &mut self, data: &[u8], metadata: &DcStr, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<()>
Appends binary data with [type]? [checksum]? DcUtf metadata using the
provided crate::DcProjectionPolicy and crate::SyntaxRuleResolver.
Sourcepub fn push_binary_with_sha256(&mut self, data: &[u8]) -> Result<()>
pub fn push_binary_with_sha256(&mut self, data: &[u8]) -> Result<()>
Appends a type-2 binary payload with a DcUtf SHA-256 checksum.
§Errors
Returns an error if checksum metadata cannot be encoded.
Sourcepub fn push_checksum(
&mut self,
format: impl Into<DcChar>,
digest: &[u8],
) -> Result<()>
pub fn push_checksum( &mut self, format: impl Into<DcChar>, digest: &[u8], ) -> Result<()>
Appends a typed checksum payload enclosed between Dc 203 and Dc 204.
Formats the payload as Dc 203 (DC_START_ENCAPSULATION_BINARY), followed by
a hash format and byte length, followed by base64 encapsulation digits
and Dc 204. Mixed mode stores the digest directly with its type.
§Errors
Returns error if base64 encoding fails.
Sourcepub fn push_system_graph_most_recent_with_id(&mut self, node_id: u128)
pub fn push_system_graph_most_recent_with_id(&mut self, node_id: u128)
Appends Dc 641 "Global graph system block most recent node ID at time of document creation"
followed by the specified System-block node ID (l<node_id>).
Sourcepub fn push_system_graph_most_recent(&mut self) -> Result<u128>
pub fn push_system_graph_most_recent(&mut self) -> Result<u128>
Appends Dc 641 "Global graph system block most recent node ID at time of document creation"
followed by the current highest allocated System-block node ID from the runtime seed graph.
§Errors
Returns an error if the shared runtime seed graph fails to load.
Sourcepub fn push_binary_from_reader<R: Read + ?Sized>(
&mut self,
reader: &mut R,
size: u64,
sha256: Option<[u8; 32]>,
) -> Result<()>
pub fn push_binary_from_reader<R: Read + ?Sized>( &mut self, reader: &mut R, size: u64, sha256: Option<[u8; 32]>, ) -> Result<()>
Appends a binary payload read directly from a stream (std::io::Read).
Sourcepub fn write_binary_encapsulation<W: Write, R: Read + ?Sized>(
writer: &mut W,
reader: &mut R,
size: u64,
sha256: Option<[u8; 32]>,
) -> Result<()>
pub fn write_binary_encapsulation<W: Write, R: Read + ?Sized>( writer: &mut W, reader: &mut R, size: u64, sha256: Option<[u8; 32]>, ) -> Result<()>
Writes binary encapsulation directly to a std::io::Write stream from a std::io::Read.
Sourcepub fn push_chunk(&mut self, chunk: &DcMixed<'_>) -> Result<()>
pub fn push_chunk(&mut self, chunk: &DcMixed<'_>) -> Result<()>
Sourcepub fn truncate(&mut self, new_len: usize)
pub fn truncate(&mut self, new_len: usize)
Shortens the DcMstring to new_len bytes.
Must not shorten past the 21-byte header.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the body of the document, resetting to an empty document with the 21-byte header.
Methods from Deref<Target = DcMstr>§
Sourcepub fn as_bytes(&self) -> &[u8] ⓘ
pub fn as_bytes(&self) -> &[u8] ⓘ
Returns the underlying byte slice (including the 21-byte header).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the total byte length of the slice (including the 21-byte header).
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the document has no payload data (only contains the 21-byte header).
Sourcepub fn payload_bytes(&self) -> &[u8] ⓘ
pub fn payload_bytes(&self) -> &[u8] ⓘ
Returns the slice of payload bytes occurring after the 21-byte header.
Sourcepub fn payload_len(&self) -> usize
pub fn payload_len(&self) -> usize
Returns the length in bytes of the payload after the 21-byte header.
Sourcepub fn chunks(&self) -> DcMixedChunks<'_> ⓘ
pub fn chunks(&self) -> DcMixedChunks<'_> ⓘ
Returns an iterator yielding DcMixed chunks (text segments and encapsulated payloads).
Sourcepub fn to_dc_string(&self) -> Result<DcString>
pub fn to_dc_string(&self) -> Result<DcString>
Converts this DcMstr into a standard DcString (DcUtf) representation.
Binary payloads are converted into base64 characters between Dc 203 and Dc 204, with byte length and any declared type or checksum.
§Errors
Returns error if base64 encoding fails.
Sourcepub fn to_dc_string_with_policy(
&self,
policy: &DcProjectionPolicy,
) -> Result<DcString>
pub fn to_dc_string_with_policy( &self, policy: &DcProjectionPolicy, ) -> Result<DcString>
Converts this DcMstr into a standard DcString (DcUtf) representation
using the provided crate::DcProjectionPolicy.
Sourcepub fn to_dc_string_with_policy_and_resolver(
&self,
policy: &DcProjectionPolicy,
resolver: &dyn SyntaxRuleResolver,
) -> Result<DcString>
pub fn to_dc_string_with_policy_and_resolver( &self, policy: &DcProjectionPolicy, resolver: &dyn SyntaxRuleResolver, ) -> Result<DcString>
Converts this DcMstr into a standard DcString (DcUtf) representation
using the provided crate::DcProjectionPolicy and crate::SyntaxRuleResolver.
Sourcepub fn to_dc_tokens(&self) -> Result<Vec<u128>>
pub fn to_dc_tokens(&self) -> Result<Vec<u128>>
Converts this DcMstr into a token stream of native u128 character
identifiers suitable for syntax parsing and validation.
§Errors
Returns an error if any character or payload cannot be converted.
Sourcepub fn decode<T: DcMixedDecode>(&self, policy: &DcProjectionPolicy) -> Result<T>
pub fn decode<T: DcMixedDecode>(&self, policy: &DcProjectionPolicy) -> Result<T>
Interprets the entire string as a typed value without changing source.
§Errors
Returns an error on unsupported syntax, missing fields, or trailing data.
Sourcepub fn decode_with_context<T: DcMixedDecode>(
&self,
context: &SharedValueContext,
policy: &DcProjectionPolicy,
) -> Result<T>
pub fn decode_with_context<T: DcMixedDecode>( &self, context: &SharedValueContext, policy: &DcProjectionPolicy, ) -> Result<T>
Interprets the whole string with explicitly supplied outer bindings.
§Errors
Returns an error if interpretation fails or trailing content remains.
Sourcepub fn decode_with_resolver<T: DcMixedDecode>(
&self,
resolver: &dyn SyntaxRuleResolver,
policy: &DcProjectionPolicy,
) -> Result<T>
pub fn decode_with_resolver<T: DcMixedDecode>( &self, resolver: &dyn SyntaxRuleResolver, policy: &DcProjectionPolicy, ) -> Result<T>
Interprets the string using a custom SyntaxRuleResolver.
§Errors
Returns an error if interpretation fails or trailing content remains.
Sourcepub fn decode_with_resolver_and_context<T: DcMixedDecode>(
&self,
resolver: &dyn SyntaxRuleResolver,
context: Option<&SharedValueContext>,
policy: &DcProjectionPolicy,
) -> Result<T>
pub fn decode_with_resolver_and_context<T: DcMixedDecode>( &self, resolver: &dyn SyntaxRuleResolver, context: Option<&SharedValueContext>, policy: &DcProjectionPolicy, ) -> Result<T>
Interprets the string using a custom SyntaxRuleResolver and optional
outer shared context.
§Errors
Returns an error if interpretation fails or trailing content remains.
Sourcepub fn inspect<T: DcMixedDecode>(&self) -> DcInspection<'_, T>
pub fn inspect<T: DcMixedDecode>(&self) -> DcInspection<'_, T>
Annotates an interpretation, preserving source even when decoding fails.
Sourcepub fn inspect_with_policy<'a, T: DcMixedDecode>(
&'a self,
policy: &DcProjectionPolicy,
) -> DcInspection<'a, T>
pub fn inspect_with_policy<'a, T: DcMixedDecode>( &'a self, policy: &DcProjectionPolicy, ) -> DcInspection<'a, T>
Annotates with an explicit projection policy.
Sourcepub fn inspect_with_context<'a, T: DcMixedDecode>(
&'a self,
context: &'a SharedValueContext,
) -> DcInspection<'a, T>
pub fn inspect_with_context<'a, T: DcMixedDecode>( &'a self, context: &'a SharedValueContext, ) -> DcInspection<'a, T>
Annotates with explicitly supplied outer reference bindings.
Sourcepub fn inspect_with_resolver<'a, T: DcMixedDecode>(
&'a self,
resolver: &'a dyn SyntaxRuleResolver,
) -> DcInspection<'a, T>
pub fn inspect_with_resolver<'a, T: DcMixedDecode>( &'a self, resolver: &'a dyn SyntaxRuleResolver, ) -> DcInspection<'a, T>
Annotates an interpretation with a custom SyntaxRuleResolver.
Sourcepub fn inspect_with_policy_and_resolver<'a, T: DcMixedDecode>(
&'a self,
policy: &DcProjectionPolicy,
resolver: &'a dyn SyntaxRuleResolver,
) -> DcInspection<'a, T>
pub fn inspect_with_policy_and_resolver<'a, T: DcMixedDecode>( &'a self, policy: &DcProjectionPolicy, resolver: &'a dyn SyntaxRuleResolver, ) -> DcInspection<'a, T>
Annotates an interpretation with an explicit policy and custom SyntaxRuleResolver.
Trait Implementations§
Source§impl DcForgivingDefault for DcMstring
impl DcForgivingDefault for DcMstring
Source§fn dc_forgiving_default() -> Self
fn dc_forgiving_default() -> Self
Source§impl DcMixedDecode for DcMstring
impl DcMixedDecode for DcMstring
Source§fn decode_dc_node(
ctx: &mut DcProjectionContext<'_, '_>,
node_id: NodeId,
) -> Result<Self>
fn decode_dc_node( ctx: &mut DcProjectionContext<'_, '_>, node_id: NodeId, ) -> Result<Self>
Source§fn decode_dc_document(
ctx: &mut DcProjectionContext<'_, '_>,
roots: &[NodeId],
) -> Result<(Self, usize)>
fn decode_dc_document( ctx: &mut DcProjectionContext<'_, '_>, roots: &[NodeId], ) -> Result<(Self, usize)>
Source§impl DcMixedEncode for DcMstring
impl DcMixedEncode for DcMstring
Source§fn encode_dc_mixed_to(&self, mst: &mut DcWriter<'_>) -> Result<()>
fn encode_dc_mixed_to(&self, mst: &mut DcWriter<'_>) -> Result<()>
fn encode_dc_mixed(&self, mst: &mut DcMstring) -> Result<()>
fn encode_dc_mixed_with_context( &self, mst: &mut DcMstring, context: &SharedValueContext, ) -> Result<()>
fn encode_format_elements_with_context( &self, format: DcChar, mst: &mut DcMstring, context: &SharedValueContext, ) -> Result<()>
Source§fn write_dc_mixed(&self, output: &mut dyn Write) -> Result<()>
fn write_dc_mixed(&self, output: &mut dyn Write) -> Result<()>
Source§fn to_dc_mixed(&self) -> Result<DcMstring>
fn to_dc_mixed(&self) -> Result<DcMstring>
Source§fn to_dc_string(&self) -> Result<DcString>
fn to_dc_string(&self) -> Result<DcString>
Source§fn encode_dc_mixed_to_with_context(
&self,
mst: &mut DcWriter<'_>,
_context: &SharedValueContext,
) -> Result<()>
fn encode_dc_mixed_to_with_context( &self, mst: &mut DcWriter<'_>, _context: &SharedValueContext, ) -> Result<()>
Source§fn encode_format_elements_to_with_context(
&self,
format: DcChar,
mst: &mut DcWriter<'_>,
context: &SharedValueContext,
) -> Result<()>
fn encode_format_elements_to_with_context( &self, format: DcChar, mst: &mut DcWriter<'_>, context: &SharedValueContext, ) -> Result<()>
Dc 511 [format] ... Dc 512 format representation container.Source§impl Extend<DcChar> for DcMstring
impl Extend<DcChar> for DcMstring
Source§fn extend<I: IntoIterator<Item = DcChar>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = DcChar>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl Extend<char> for DcMstring
impl Extend<char> for DcMstring
Source§fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = char>>(&mut self, iter: I)
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one)Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one)Source§impl FromIterator<DcChar> for DcMstring
impl FromIterator<DcChar> for DcMstring
Source§impl FromIterator<char> for DcMstring
impl FromIterator<char> for DcMstring
Source§impl Ord for DcMstring
impl Ord for DcMstring
Source§impl PartialOrd for DcMstring
impl PartialOrd for DcMstring
impl Eq for DcMstring
impl StructuralPartialEq for DcMstring
Auto Trait Implementations§
impl Freeze for DcMstring
impl RefUnwindSafe for DcMstring
impl Send for DcMstring
impl Sync for DcMstring
impl Unpin for DcMstring
impl UnwindSafe for DcMstring
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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);§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
impl<T, U> RoundingInto<U> for Twhere
U: RoundingFrom<T>,
fn rounding_into(self, rm: RoundingMode) -> (U, Ordering)
§impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
impl<T, U> SaturatingInto<U> for Twhere
U: SaturatingFrom<T>,
fn saturating_into(self) -> U
§impl<T> ToDebugString for Twhere
T: Debug,
impl<T> ToDebugString for Twhere
T: Debug,
§fn to_debug_string(&self) -> String
fn to_debug_string(&self) -> String
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)