[−][src]Struct fui::Fui
Top level building block of fui
crate.
Methods
impl<'attrs, 'action> Fui<'attrs, 'action>
[src]
pub fn new(program_name: &'attrs str) -> Self
[src]
Creates a new Fui
with empty actions.
pub fn action<F>(
self,
name: &'action str,
help: &'action str,
form: FormView,
hdlr: F
) -> Self where
F: Fn(Value) + 'static,
[src]
self,
name: &'action str,
help: &'action str,
form: FormView,
hdlr: F
) -> Self where
F: Fn(Value) + 'static,
Defines action by providing name
, help
, form
, hdlr
.
NOTE:
name
is also translated into CLI argument, so:
- "my-arg" is ok (only
"a..z"
&"-"
) - "my arg" is bad (becuase in shell space (
" "
) needs to be escaped)
Panics:
Panics if action name is duplicated.
pub fn run(self)
[src]
Coordinates flow from action picking to handler running.
pub fn get_cli_input(self) -> Vec<String>
[src]
Gets user input converted to cli-like format
pub fn build_cli_app(&self) -> App
[src]
Returns automatiacally generated clap::App.
pub fn name(self, name: &'attrs str) -> Self
[src]
Sets program's name
.
For CLI means Clap::App::name
pub fn get_name(&self) -> &str
[src]
Gets program's name
.
pub fn get_about(&self) -> &str
[src]
Gets program's about
.
pub fn get_author(&self) -> &str
[src]
Gets program's author
.
pub fn get_version(&self) -> &str
[src]
Gets program's version
.
pub fn version(self, version: &'attrs str) -> Self
[src]
Sets program's version
.
For CLI means Clap::App::version
pub fn about(self, about: &'attrs str) -> Self
[src]
Sets program's about
.
For CLI means Clap::App::about
pub fn author(self, author: &'attrs str) -> Self
[src]
Sets program's author
.
For CLI means Clap::App::author
pub fn theme(self, theme: &'attrs str) -> Self
[src]
Sets theme
for Fui
.
For details see Cursive's themes
Example:
use fui::Fui; use fui::form::FormView; use fui::fields::Text; let my_theme = " shadow = false borders = \"simple\" [colors] background = \"yellow\" "; let app = Fui::new("program_name") .action( "action1", "desc", FormView::new().field(Text::new("action1-data")), |v| { println!("{:?}", v); } ) .theme(my_theme);
pub fn skip_single_action(self, skip: bool) -> Self
[src]
Sets value for skip_single_action
pub fn skip_empty_form(self, skip: bool) -> Self
[src]
Sets value for skip_empty_form
Trait Implementations
Auto Trait Implementations
impl<'attrs, 'action> !Sync for Fui<'attrs, 'action>
impl<'attrs, 'action> !Send for Fui<'attrs, 'action>
impl<'attrs, 'action> Unpin for Fui<'attrs, 'action>
impl<'attrs, 'action> !RefUnwindSafe for Fui<'attrs, 'action>
impl<'attrs, 'action> !UnwindSafe for Fui<'attrs, 'action>
Blanket Implementations
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> With for T
[src]
fn with<F>(self, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
Calls the given closure on self
.
fn try_with<E, F>(self, f: F) -> Result<Self, E> where
F: FnOnce(&mut Self) -> Result<(), E>,
[src]
F: FnOnce(&mut Self) -> Result<(), E>,
Calls the given closure on self
.
fn with_if<F>(self, condition: bool, f: F) -> Self where
F: FnOnce(&mut Self),
[src]
F: FnOnce(&mut Self),
Calls the given closure if condition == true
.