pub struct Html<T: Write> { /* private fields */ }
Expand description

An adaptor to allow writing stylish attributed data to an output stream by turning attributes into HTML elements.

let mut writer = stylish::Html::new(String::new());
stylish::write!(writer, "Hello {:(fg=red)}", "Ferris")?;
assert_eq!(
    writer.finish()?,
    "Hello <span style=color:red>Ferris</span>",
);

Implementations

Wrap the given output stream in this adaptor.

Inherent delegation to stylish::Write::write_fmt to not require a trait import.

Ensure the output stream is reset back to the default style and return it, if you don’t call this the stream will be left in whatever style the last output data was.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Writes a string slice with a particular [Style] into this writer, returning whether the write succeeded. Read more

Writes a char with a particular [Style] into this writer, returning whether the write succeeded. Read more

Glue for usage of the [stylish::write!] macro with implementors of this trait. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.