Struct Styles
pub struct Styles { /* private fields */ }
Terminal styling definitions
See also [Command::styles][crate::Command::styles].
Example
clap v3 styling
# use clap_builder as clap;
# use *;
let styles = styled
.header
.usage
.literal
.placeholder;
Implementations
impl Styles
const fn get_header(&self) -> &StyleGeneral Heading style, e.g. [
help_heading][crate::Arg::help_heading]const fn get_error(&self) -> &StyleError heading
const fn get_usage(&self) -> &StyleUsage heading
const fn get_literal(&self) -> &StyleLiteral command-line syntax, e.g.
--helpconst fn get_placeholder(&self) -> &StyleDescriptions within command-line syntax, e.g. [
value_name][crate::Arg::value_name]const fn get_valid(&self) -> &StyleHighlight suggested usage
const fn get_invalid(&self) -> &StyleHighlight invalid usage
const fn get_context(&self) -> &StyleHighlight all specified contexts, e.g.
[default: false]To specialize the style of the value within the context, see
Styles::context_valueconst fn get_context_value(&self) -> &StyleHighlight values within all of the context, e.g. the
falsein[default: false]If not explicitly set, falls back to
context's style.
impl Styles
const fn plain() -> SelfNo terminal styling
const fn styled() -> SelfDefault terminal styling
const fn header(self, style: Style) -> SelfGeneral Heading style, e.g. [
help_heading][crate::Arg::help_heading]const fn error(self, style: Style) -> SelfError heading
const fn usage(self, style: Style) -> SelfUsage heading
const fn literal(self, style: Style) -> SelfLiteral command-line syntax, e.g.
--helpconst fn placeholder(self, style: Style) -> SelfDescriptions within command-line syntax, e.g. [
value_name][crate::Arg::value_name]const fn valid(self, style: Style) -> SelfHighlight suggested usage
const fn invalid(self, style: Style) -> SelfHighlight invalid usage
const fn context(self, style: Style) -> SelfHighlight all specified contexts, e.g.
[default: false]To specialize the style of the value within the context, see
Styles::context_valueconst fn context_value(self, style: Style) -> SelfHighlight values within all of the context, e.g. the
falsein[default: false]If not explicitly set, falls back to
context's style.
Trait Implementations
impl Clone for Styles
fn clone(&self) -> Self
impl Debug for Styles
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Styles
fn default() -> Self
Auto Trait Implementations
impl Freeze for Styles
impl RefUnwindSafe for Styles
impl Send for Styles
impl Sync for Styles
impl Unpin for Styles
impl UnsafeUnpin for Styles
impl UnwindSafe for Styles
Blanket Implementations
impl<T> Any for Styles
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Styles
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Styles
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Styles
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Styles
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Styles
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Styles
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Styles
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Styles
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>