Struct dioxus_fullstack::prelude::DioxusServerContext

source ·
pub struct DioxusServerContext { /* private fields */ }
Available on crate feature 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

source

pub fn new(parts: Parts) -> Self

Create a new server context from a request

source

pub fn get<T: Any + Send + Sync + Clone + 'static>(&self) -> Option<T>

Clone a value from the shared server context

source

pub fn insert<T: Any + Send + Sync + 'static>(&self, value: T)

Insert a value into the shared server context

source

pub fn insert_any(&self, value: Box<dyn Any + Send + Sync>)

Insert a Boxed Any value into the shared server context

source

pub fn response_parts(&self) -> RwLockReadGuard<'_, Parts>

Get the response parts from the server context

source

pub fn response_parts_mut(&self) -> RwLockWriteGuard<'_, Parts>

Get the response parts from the server context

source

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
source

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
source

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

source§

fn clone(&self) -> DioxusServerContext

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for DioxusServerContext

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<Ret> SpawnIfAsync<(), Ret> for Ret

source§

fn spawn(self) -> Ret

Spawn the value into the dioxus runtime if it is an async block
source§

impl<T, O> SuperFrom<T> for O
where O: From<T>,

source§

fn super_from(input: T) -> O

Convert from a type to another type.
source§

impl<T, O, M> SuperInto<O, M> for T
where O: SuperFrom<T, M>,

source§

fn super_into(self) -> O

Convert from a type to another type.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,