[−][src]Struct roost_app::Store
Manages the state wrapper and routing of the Roost application
Fields
state: StateWrapper
A tuple struct that holds the application state
after_route: Option<Box<dyn Fn(&str)>>
An function that will execute after the route has changed
router: Option<Rc<Router>>
Handles routing operations once created accordingly in app/src/lib.rs
listeners: Vec<Box<dyn Fn()>>
A Vec
of callback functions provided by subscribed clients that will execute after a
change of state
Methods
impl Store
[src]
pub fn new(state: State) -> Store
[src]
Returns a Store
with a StateWrapper
that is holding the provided State
pub fn msg(&mut self, msg: &Msg)
[src]
The function that handles a change of application state.
Available changes that can be made to the application state can be found in
app/src/state/msg.rs
pub fn subscribe(&mut self, callback: Box<dyn Fn()>)
[src]
For a client to call when they want their provided callback function to be executed on a change of application state
pub fn set_after_route(&mut self, after_route: Box<dyn Fn(&str)>)
[src]
Set the function that will execute when the current route has changed
pub fn set_router(&mut self, router: Rc<Router>)
[src]
Set the router to handle available routes in our application
Methods from Deref<Target = State>
pub fn path(&self) -> &str
[src]
Returns a reference to self.path
pub fn entry_path(&self) -> &Path
[src]
Returns a reference to self.entry_path
pub fn dir_contents(&self) -> &Option<Vec<DirEntry>>
[src]
Returns a reference to self.dir_contents
pub fn file_contents(&self) -> &Option<String>
[src]
Returns a reference to self.file_contents
pub fn patches(&self) -> &Vec<PatchHeader>
[src]
Returns a reference to self.patches
pub fn render_md(&self) -> &bool
[src]
Returns a reference to self.render_md
pub fn selected_patch(&self) -> &Option<String>
[src]
Returns a reference to self.selected_patch
pub fn entry_contents(&self) -> EntryContents
[src]
Returns a new EntryContents that is contructed from the clones of this State's matching fields
pub fn is_dir(&self) -> bool
[src]
Whether or not self.entry_path
ends with a '/' character
pub fn encoded_path(&self) -> String
[src]
self.entry_path
represented as a URL-encoded string, without the prefix "./"
Trait Implementations
Auto Trait Implementations
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,