[][src]Enum cmus_status_line::cmus_status::output::FormatPart

pub enum FormatPart {
    Text(String),
    Title,
    Status,
    MatchStatus(CmusPlaybackStatus, String),
    Truncate(Box<FormatPart>, usize),
    HtmlEscape(Box<FormatPart>),
    ProgressBar(ProgressBarConfig),
    Container(Vec<Box<FormatPart>>),
    If(FormatExpressionBox<FormatPart>),
}

Variants

Text(String)

Just print the given text. This whole variant can be represented as a string. Config example:

    format = "Hello from the status-line!"
Title

Prints the currently playing song's name.

Status

Prints the CmusPlaybackStatus of the playing song.

MatchStatus(CmusPlaybackStatus, String)

TODO: Deprecated, use with FormatPart::If conditional. If the first argument's status is the current CmusPlaybackStatus, then, print the given string. The CmusPlaybackStatus can be one of:

  • Playing
  • Paused
  • Stopped
Truncate(Box<FormatPart>, usize)

Truncate the given FormatPart to the given length (usize). Max length is inclusive. Config example:

    format = "%{ Truncate(Status, 60) }"
HtmlEscape(Box<FormatPart>)

Run htmlescape::encode_minimal on the wrapped FormatPart's resulting string.

ProgressBar(ProgressBarConfig)

Prints a ProgressBar with the given ProgressBarConfig. ProgressBarConfig can be a string such as: Config example:

    format = """
    %{ ProgressBar("<###--->") }
    """

... where the first and last characters (<,>) are used as the start and end characters of the bar, respectively. The second character in the string (#) is used as the "full" character, and the second to last as the "empty" (-) character. The "full" characters are printed if the playback percentage of the track has reached that point, the "empty" characters if it hasn't. The total length of the string is also the printed length.

Container(Vec<Box<FormatPart>>)

A list of FormatParts. Useful with FormatPart::If. Config example:

    format = """
    %{ Container([
        Text("Hello "),
        Text("World! "),
        Status,
    ]) }
    """

If conditional. If the FormatExpression returns true, then FormatPart is printed. Config example:

    format = """
    %{ If(IsStatus(Playing),
       "Cmus is playing a song!") }
    """

Trait Implementations

impl<'de> Deserialize<'de> for FormatPart[src]

impl<'a> From<Box<&'a FormatPart>> for &'a FormatPart[src]

impl From<Box<FormatPart>> for FormatPart[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.