pub struct AppContext { /* private fields */ }Expand description
AppContext Is Used for Managing state in your Feather Application
Context Should only used with objects like Connections and Custom Structs!
Implementations§
Source§impl AppContext
impl AppContext
Sourcepub fn get_state<T: 'static>(&self) -> Option<&T>
pub fn get_state<T: 'static>(&self) -> Option<&T>
Used the Read the State from the Context you can use the turbofish syntax to access objects
Like this:
let db = ctx.read_state::<Connection>();Sourcepub fn get_mut_state<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_mut_state<T: 'static>(&mut self) -> Option<&mut T>
Used the Read the State from the Context you can use the turbofish syntax to access objects
Like this:
let db = ctx.read_state::<Connection>();Returns a Mutable referance to the object
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppContext
impl !RefUnwindSafe for AppContext
impl !Send for AppContext
impl !Sync for AppContext
impl Unpin for AppContext
impl !UnwindSafe for AppContext
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
Mutably borrows from an owned value. Read more