pub struct Doc {
payload: String,
tokens: Vec<Token>,
}Expand description
String with styled segments.
You can add style information to generated documentation and help messages
For simpliest possible results you can also pass a string slice in all the places
that require impl Into<Doc>
Fields§
§payload: Stringstring info saved here
tokens: Vec<Token>string meta info tokens
Implementations§
Source§impl Doc
impl Doc
Sourcepub fn monochrome(&self, full: bool) -> String
pub fn monochrome(&self, full: bool) -> String
Render a monochrome version of the document
full indicates if full message should be rendered, this makes
difference for rendered help message, otherwise you can pass true.
pub(crate) fn render_console( &self, full: bool, color: Color, max_width: usize, ) -> String
Source§impl Doc
impl Doc
Sourcepub fn render_markdown(&self, full: bool) -> String
pub fn render_markdown(&self, full: bool) -> String
Render doc into markdown document, used by documentation sample generator
Source§impl Doc
impl Doc
Source§impl Doc
impl Doc
pub(crate) fn write_shortlong(&mut self, name: &ShortLong)
pub(crate) fn write_item(&mut self, item: &Item)
pub(crate) fn write_meta(&mut self, meta: &Meta, for_usage: bool)
Source§impl Doc
impl Doc
pub(crate) fn token(&mut self, token: Token)
pub(crate) fn write<T>(&mut self, input: T, style: Style)where
T: Display,
fn set_style(&mut self, len: usize, style: Style)
pub(crate) fn write_str(&mut self, input: &str, style: Style)
pub(crate) fn write_char(&mut self, c: char, style: Style)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Doc
impl RefUnwindSafe for Doc
impl Send for Doc
impl Sync for Doc
impl Unpin for Doc
impl UnwindSafe for Doc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more