[][src]Struct roost_app::store::Store

pub struct Store {
    state: StateWrapper,
    after_route: Option<Box<dyn Fn(&str)>>,
    router: Option<Rc<Router>>,
    listeners: Vec<Box<dyn Fn()>>,
}

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 to_json(&self) -> String[src]

Serializes this State to JSON

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

impl Deref for Store[src]

type Target = State

The resulting type after dereferencing.

Auto Trait Implementations

impl !Send for Store

impl !Sync for Store

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]