ltpp_output

Struct Output

source
pub struct Output<'a> {
Show 16 fields pub text: &'a str, pub text_color: Option<ColorType>, pub text_bg_color: Option<ColorType>, pub text_blod: Option<bool>, pub show_time: Option<bool>, pub time_text_color: Option<ColorType>, pub time_bg_color: Option<ColorType>, pub time_text_blod: Option<bool>, pub show_code_location: Option<bool>, pub code_location_text_color: Option<ColorType>, pub code_location_bg_color: Option<ColorType>, pub code_location_text_blod: Option<bool>, pub split: Option<&'a str>, pub split_color: Option<ColorType>, pub split_bg_color: Option<ColorType>, pub split_text_blod: Option<bool>,
}
Expand description

输出结构体

官方文档

§代码示例

§使用结构体

§使用 output 函数

use ltpp_output::*;
output(Output {
    text: "test_output_struct",
    text_color: Some(ColorType::Use(Color::Default)),
    text_bg_color: Some(ColorType::Color256(0x000000)),
    show_time: Some(true),
    show_code_location: Some(true),
    time_text_color: Some(ColorType::Rgb(255, 255, 255)),
    time_bg_color: Some(ColorType::Use(Color::Yellow)),
    code_location_text_color: Some(ColorType::Color256(0xffffff)),
    code_location_bg_color: Some(ColorType::Use(Color::Yellow)),
    split: Some(" => "),
    split_color: Some(ColorType::Use(Color::Cyan)),
    split_bg_color: Some(ColorType::Use(Color::Yellow)),
    ..Default::default()
});

§使用 output 方法

use ltpp_output::*;
Output {
    text: "test_output_struct_output",
    text_color: Some(ColorType::Use(Color::Default)),
    text_bg_color: Some(ColorType::Color256(0x000000)),
    show_time: Some(true),
    show_code_location: Some(true),
    time_text_color: Some(ColorType::Rgb(255, 255, 255)),
    time_bg_color: Some(ColorType::Use(Color::Yellow)),
    code_location_text_color: Some(ColorType::Color256(0xffffff)),
    code_location_bg_color: Some(ColorType::Use(Color::Yellow)),
    split: Some(" => "),
    split_color: Some(ColorType::Use(Color::Cyan)),
    split_bg_color: Some(ColorType::Use(Color::Yellow)),
    ..Default::default()
}
.output();

§使用构造器

§使用 output 函数

use ltpp_output::*;
output(
    OutputBuilder::new()
        .set_text("test_output_builder")
        .set_text_color(ColorType::Color256(0xffffff))
        .set_time_text_color(ColorType::Rgb(255, 200, 255))
        .set_code_location_text_color(ColorType::Use(Color::Yellow))
        .set_text_blod(true)
        .set_time_text_blod(true)
        .set_code_location_text_blod(true)
        .set_show_time(true)
        .set_show_code_location(true)
        .build(),
);

§使用 output 方法

use ltpp_output::*;
OutputBuilder::new()
    .set_text("test_output_builder_output")
    .set_text("test_output_builder")
    .set_text_color(ColorType::Color256(0xffffff))
    .set_time_text_color(ColorType::Rgb(255, 200, 255))
    .set_code_location_text_color(ColorType::Use(Color::Yellow))
    .set_text_blod(true)
    .set_time_text_blod(true)
    .set_code_location_text_blod(true)
    .set_show_time(true)
    .set_show_code_location(true)
    .build()
    .output();

Fields§

§text: &'a str

输出文字

§text_color: Option<ColorType>

输出文字颜色

§text_bg_color: Option<ColorType>

输出文字背景颜色

§text_blod: Option<bool>

文字加粗

§show_time: Option<bool>

是否显示时间

§time_text_color: Option<ColorType>

时间文字颜色

§time_bg_color: Option<ColorType>

时间背景颜色

§time_text_blod: Option<bool>

时间文字加粗

§show_code_location: Option<bool>

是否显示代码位置

§code_location_text_color: Option<ColorType>

代码位置文字颜色

§code_location_bg_color: Option<ColorType>

代码位置背景颜色

§code_location_text_blod: Option<bool>

代码位置文字加粗

§split: Option<&'a str>

分隔符

§split_color: Option<ColorType>

分隔符文字颜色

§split_bg_color: Option<ColorType>

分隔符背景颜色

§split_text_blod: Option<bool>

分隔符文字加粗

Implementations§

source§

impl<'a> Output<'a>

source

pub fn output(self)

Trait Implementations§

source§

impl<'a> Clone for Output<'a>

source§

fn clone(&self) -> Output<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Output<'a>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> Default for Output<'a>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<'a> Freeze for Output<'a>

§

impl<'a> RefUnwindSafe for Output<'a>

§

impl<'a> Send for Output<'a>

§

impl<'a> Sync for Output<'a>

§

impl<'a> Unpin for Output<'a>

§

impl<'a> UnwindSafe for Output<'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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.