pub struct FM { /* private fields */ }Expand description
Holds everything about the application itself.
Dropping the instance of FM allows to write again to stdout.
It should be ran like this : crate::app::Fm::start().run().quit().
The application is split into several components:
- a reader of FmEvents,
- a dispatcher of said events,
- the state of the application itself, which is mutated by the dispatcher,
- a displayer which holds a non mutable reference to the state. The displayer can emits events to force state change if needs be.
- a refresher which is used to force a refresh state + display if something happened externally or in some running thread.
Implementations§
Source§impl FM
impl FM
Sourcepub fn start() -> Result<Self>
pub fn start() -> Result<Self>
Setup everything the application needs in its main loop :
a panic hook for graceful panic and displaying a traceback for debugging purpose,
an EventReader,
an EventDispatcher,
a Status,
a Display,
a Refresher.
It reads and drops the configuration from the config file.
If the config can’t be parsed, it exits with error code 1.
§Errors
May fail if the ratatui::DefaultTerminal can’t be started or crashes
Sourcepub fn exit_wrong_config() -> !
pub fn exit_wrong_config() -> !
Exit the application and log a message. Used when the config can’t be read.
Sourcepub fn run(self) -> Result<Self>
pub fn run(self) -> Result<Self>
Run the update status loop and returns itself after completion.
Sourcepub fn quit(self) -> Result<()>
pub fn quit(self) -> Result<()>
Reset everything as best as possible, stop any long thread in a loop and exit.
More specifically :
- Display the cursor,
- drop itself, which allow us to print normally afterward
- print the final path
§Errors
May fail if the terminal crashes
May also fail if the thread running in crate::app::Refresher crashed
Auto Trait Implementations§
impl Freeze for FM
impl !RefUnwindSafe for FM
impl Send for FM
impl !Sync for FM
impl Unpin for FM
impl !UnwindSafe for FM
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more