Struct dioxus_fullstack::prelude::DioxusServerContext
source · pub struct DioxusServerContext { /* private fields */ }server only.Expand description
A shared context for server functions that contains information about the request and middleware state. This allows you to pass data between your server framework and the server functions. This can be used to pass request information or information about the state of the server. For example, you could pass authentication data though this context to your server functions.
You should not construct this directly inside components. Instead use the HasServerContext trait to get the server context from the scope.
Implementations§
source§impl DioxusServerContext
impl DioxusServerContext
sourcepub fn get<T: Any + Send + Sync + Clone + 'static>(&self) -> Option<T>
pub fn get<T: Any + Send + Sync + Clone + 'static>(&self) -> Option<T>
Clone a value from the shared server context
sourcepub fn insert<T: Any + Send + Sync + 'static>(&self, value: T)
pub fn insert<T: Any + Send + Sync + 'static>(&self, value: T)
Insert a value into the shared server context
sourcepub fn insert_any(&self, value: Box<dyn Any + Send + Sync>)
pub fn insert_any(&self, value: Box<dyn Any + Send + Sync>)
Insert a Boxed Any value into the shared server context
sourcepub fn response_parts(&self) -> RwLockReadGuard<'_, Parts>
pub fn response_parts(&self) -> RwLockReadGuard<'_, Parts>
Get the response parts from the server context
sourcepub fn response_parts_mut(&self) -> RwLockWriteGuard<'_, Parts>
pub fn response_parts_mut(&self) -> RwLockWriteGuard<'_, Parts>
Get the response parts from the server context
sourcepub fn request_parts(&self) -> RwLockReadGuard<'_, Parts>
pub fn request_parts(&self) -> RwLockReadGuard<'_, Parts>
Get the request that triggered:
- The initial SSR render if called from a ScopeState or ServerFn
- The server function to be called if called from a server function after the initial render
sourcepub fn request_parts_mut(&self) -> RwLockWriteGuard<'_, Parts>
pub fn request_parts_mut(&self) -> RwLockWriteGuard<'_, Parts>
Get the request that triggered:
- The initial SSR render if called from a ScopeState or ServerFn
- The server function to be called if called from a server function after the initial render
sourcepub async fn extract<R: Error, T: FromServerContext<Rejection = R>>(
&self,
) -> Result<T, R>
pub async fn extract<R: Error, T: FromServerContext<Rejection = R>>( &self, ) -> Result<T, R>
Extract some part from the request
Trait Implementations§
source§impl Clone for DioxusServerContext
impl Clone for DioxusServerContext
source§fn clone(&self) -> DioxusServerContext
fn clone(&self) -> DioxusServerContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for DioxusServerContext
impl !RefUnwindSafe for DioxusServerContext
impl Send for DioxusServerContext
impl Sync for DioxusServerContext
impl Unpin for DioxusServerContext
impl !UnwindSafe for DioxusServerContext
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)