[−][src]Struct spirit::app::App
The running application part.
This is returned by Builder::build
and represents the rest of
the application runtime except the actual application body. It can be used to run at any later
time, after the spirit has been created.
This carries all the around-bodies and before-bodies. If you run the application body directly, not through this, some of the pipelines or extensions might not work as expected.
The Builder::run
is just a convenient wrapper around this. Note
that that one handles and logs errors from the application startup as well as from its runtime.
Here it is up to the caller to handle the startup errors.
Examples
use spirit::prelude::*; Spirit::<Empty, Empty>::new() .build(true)? .run_term(|| { println!("Hello world"); Ok(()) });
Methods
impl<O, C> App<O, C> where
O: StructOpt + Send + Sync + 'static,
C: DeserializeOwned + Send + Sync + 'static,
[src]
O: StructOpt + Send + Sync + 'static,
C: DeserializeOwned + Send + Sync + 'static,
pub fn spirit(&self) -> &Arc<Spirit<O, C>>
[src]
Access to the built spirit object.
The object can be used to manipulate the runtime of the application, access the current configuration and register further callbacks (and extensions and pipelines).
Depending on your needs, you may pass it to the closure started with run
or
even placed into some kind of global storage.
pub fn run<B>(self, body: B) -> Result<(), Error> where
B: FnOnce() -> Result<(), Error> + Send + 'static,
[src]
B: FnOnce() -> Result<(), Error> + Send + 'static,
Run the application with provided body.
This will run the provided body. However, it'll wrap it in all the
around-bodies and precede it with all the
before-bodies. If any of these fail, or if the body
fails, the error is propagated (and further bodies are not started).
Any errors are simply returned and it is up to the caller to handle them somehow.
pub fn run_term<B>(self, body: B) where
B: FnOnce() -> Result<(), Error> + Send + 'static,
[src]
B: FnOnce() -> Result<(), Error> + Send + 'static,
Auto Trait Implementations
Blanket Implementations
impl<T> IntoResult for T
[src]
fn into_result(Self) -> Result<T, Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,