pub struct StyleWith;Available on crate feature
color and crate feature rkyv and (crate features color or trace) only.Expand description
rkyv ArchiveWith wrapper for console::Style.
Serializes a Style as its dotted attribute string (e.g.
"bold.red.on_blue"), reconstructable via Style::from_dotted_str.
The conversion works by forcing ANSI escape code emission on a clone of the style, extracting the codes from the output, and mapping them back to their named dotted-format equivalents. The roundtrip is functionally lossless: the deserialized style produces identical terminal output, though the internal representation may differ for edge cases such as 256-color indices 8–15 which overlap with bright basic colors.
Use with #[rkyv(with = rkyv::with::Map<StyleWith>)] on Option<Style>
fields.
Trait Implementations§
Source§impl ArchiveWith<Style> for StyleWith
impl ArchiveWith<Style> for StyleWith
Source§type Archived = ArchivedString
type Archived = ArchivedString
The archived type of
Self with F.Source§type Resolver = StringResolver
type Resolver = StringResolver
The resolver of a
Self with F.impl Copy for StyleWith
Source§impl<D> DeserializeWith<ArchivedString, Style, D> for StyleWith
impl<D> DeserializeWith<ArchivedString, Style, D> for StyleWith
Source§fn deserialize_with(
field: &ArchivedString,
_: &mut D,
) -> Result<Style, D::Error>
fn deserialize_with( field: &ArchivedString, _: &mut D, ) -> Result<Style, D::Error>
Deserializes the field type
F using the given deserializer.Auto Trait Implementations§
impl Freeze for StyleWith
impl RefUnwindSafe for StyleWith
impl Send for StyleWith
impl Sync for StyleWith
impl Unpin for StyleWith
impl UnsafeUnpin for StyleWith
impl UnwindSafe for StyleWith
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.