[−][src]Enum cmus_status_line::cmus_status::output::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!"
Prints the currently playing song's name.
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.
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 FormatPart
s.
Useful with FormatPart::If
.
Config example:
format = """
%{ Container([
Text("Hello "),
Text("World! "),
Status,
]) }
"""
If(FormatExpression, Box<FormatPart>)
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]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<'a> From<Box<&'a FormatPart>> for &'a FormatPart
[src]
fn from(b: Box<&'a FormatPart>) -> Self
[src]
impl From<Box<FormatPart>> for FormatPart
[src]
fn from(b: Box<FormatPart>) -> Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for FormatPart
impl Send for FormatPart
impl Sync for FormatPart
impl Unpin for FormatPart
impl UnwindSafe for FormatPart
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,