pub struct Doc { /* private fields */ }
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>
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
.
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
sourcepub fn text(&mut self, text: &str)
pub fn text(&mut self, text: &str)
Examples found in repository?
examples/customize_help.rs (line 17)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let opt = short('d')
.help("Release the dragon")
.switch()
.to_options()
.descr("I am a program and I do things")
.header("Sometimes they even work.")
.footer("Beware `-d`, dragons be here")
.with_usage(|doc| {
let mut u = Doc::default();
u.emphasis("You can call it with following flags:");
u.text(" ");
u.doc(&doc);
u
})
.run();
println!("{:?}", opt);
}
sourcepub fn emphasis(&mut self, text: &str)
pub fn emphasis(&mut self, text: &str)
Examples found in repository?
examples/customize_help.rs (line 16)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let opt = short('d')
.help("Release the dragon")
.switch()
.to_options()
.descr("I am a program and I do things")
.header("Sometimes they even work.")
.footer("Beware `-d`, dragons be here")
.with_usage(|doc| {
let mut u = Doc::default();
u.emphasis("You can call it with following flags:");
u.text(" ");
u.doc(&doc);
u
})
.run();
println!("{:?}", opt);
}
sourcepub fn doc(&mut self, buf: &Doc)
pub fn doc(&mut self, buf: &Doc)
Examples found in repository?
examples/customize_help.rs (line 18)
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
fn main() {
let opt = short('d')
.help("Release the dragon")
.switch()
.to_options()
.descr("I am a program and I do things")
.header("Sometimes they even work.")
.footer("Beware `-d`, dragons be here")
.with_usage(|doc| {
let mut u = Doc::default();
u.emphasis("You can call it with following flags:");
u.text(" ");
u.doc(&doc);
u
})
.run();
println!("{:?}", opt);
}
Trait Implementations§
Auto Trait Implementations§
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