Struct OutputBuilder

Source
pub struct OutputBuilder<'a> {
    pub output: Output<'a>,
}
Expand description

OutputBuilder struct

Official Documentation,

§Code Example

§Using the OutputBuilder

§Using the output Function

use ltpp_output::*;
output(
    OutputBuilder::new_from(Output::default())
        .set_text("test_output_builder")
        .set_text_color(ColorType::Color256(0xffffff))
        .set_text_bg_color(ColorType::Color256(0xffffff))
        .set_split_bg_color(ColorType::Color256(0xffffff))
        .set_time_text_color(ColorType::Rgb(255, 200, 255))
        .set_text_blod(true)
        .set_time_text_blod(true)
        .set_show_time(true)
        .set_endl(true)
        .build(),
);

§Using the output Method

use ltpp_output::*;
OutputBuilder::new()
    .set_text("test_output_builder_output")
    .set_text_bg_color(ColorType::Color256(0xffffff))
    .set_text_color(ColorType::Color256(0xffffff))
    .set_time_text_color(ColorType::Rgb(255, 200, 255))
    .set_text_blod(true)
    .set_time_text_blod(true)
    .set_show_time(true)
    .set_endl(true)
    .build()
    .output();

Fields§

§output: Output<'a>

Implementations§

Source§

impl<'a> OutputBuilder<'a>

Source

pub fn new() -> Self

Creates the struct

§Returns
  • OutputBuilder: Output
Source

pub fn new_from(output: Output<'a>) -> Self

Creates the struct from output

§Returns
  • OutputBuilder: Output
Source

pub fn set_text(&mut self, text: &'a str) -> &mut Self

Sets the text.

§Parameters
  • text: The text to be set.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_text_color(&mut self, text_color: ColorType) -> &mut Self

Sets the text color.

§Parameters
  • text_color: The color to be set for the text.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_text_bg_color(&mut self, text_bg_color: ColorType) -> &mut Self

Sets the background color for the text.

§Parameters
  • text_bg_color: The background color to be set for the text.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_text_blod(&mut self, text_blod: bool) -> &mut Self

Sets whether the text should be bold.

§Parameters
  • text_blod: A boolean indicating whether the text should be bold.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_show_time(&mut self, show_time: bool) -> &mut Self

Sets whether to show the time.

§Parameters
  • show_time: A boolean indicating whether to display the time.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_time_text_color(&mut self, time_text_color: ColorType) -> &mut Self

Sets the time text color.

§Parameters
  • time_text_color: The color to be set for the time text.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_time_bg_color(&mut self, time_bg_color: ColorType) -> &mut Self

Sets the background color for the time text.

§Parameters
  • time_bg_color: The background color to be set for the time text.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_time_text_blod(&mut self, time_text_blod: bool) -> &mut Self

Sets whether the time text should be bold.

§Parameters
  • time_text_blod: A boolean indicating whether the time text should be bold.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_split_text(&mut self, split: &'a str) -> &mut Self

Sets the separator.

§Parameters
  • split: The separator string to be set.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_split_text_color(&mut self, split_color: ColorType) -> &mut Self

Sets the separator color.

§Parameters
  • split_color: The color to be set for the separator.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_split_bg_color(&mut self, split_bg_color: ColorType) -> &mut Self

Sets the background color for the separator.

§Parameters
  • split_bg_color: The background color to be set for the separator.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_split_text_blod(&mut self, split_text_blod: bool) -> &mut Self

Sets whether the separator text should be bold.

§Parameters
  • split_text_blod: A boolean indicating whether the separator text should be bold.
§Returns
  • &mut Self: A mutable reference to the struct for method chaining.
Source

pub fn set_endl(&mut self, endl: bool) -> &mut Self

Sets the endl value for the Output.

§Parameters
  • endl: A boolean value that determines whether to add a newline at the end.
§Returns
  • &mut Self: Returns a mutable reference to the current Output instance, allowing method chaining.
Source

pub fn build(&self) -> Output<'_>

Builds and returns the Output struct.

§Returns
  • Output: The constructed Output struct.
Source

pub fn output(&self)

Outputs the current state of the Output struct.

§Returns
  • () : Nothing is returned.

Auto Trait Implementations§

§

impl<'a> Freeze for OutputBuilder<'a>

§

impl<'a> RefUnwindSafe for OutputBuilder<'a>

§

impl<'a> Send for OutputBuilder<'a>

§

impl<'a> Sync for OutputBuilder<'a>

§

impl<'a> Unpin for OutputBuilder<'a>

§

impl<'a> UnwindSafe for OutputBuilder<'a>

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.