Struct perseus::state::GlobalStateCreator
source · [−]pub struct GlobalStateCreator { /* private fields */ }
Expand description
A creator for global state. This stores user-provided functions that will be invoked to generate global state on the client and the server.
The primary purpose of this is to allow the generation of top-level app state on the server and the client. Notably, this can also be interacted with by plugins.
Implementations
sourceimpl GlobalStateCreator
impl GlobalStateCreator
sourcepub fn build_state_fn(
self,
val: impl GlobalStateCreatorFnType + Send + Sync + 'static
) -> Self
pub fn build_state_fn(
self,
val: impl GlobalStateCreatorFnType + Send + Sync + 'static
) -> Self
Adds a function to generate global state at build-time.
sourcepub async fn get_build_state(&self) -> Result<Option<String>, GlobalStateError>
pub async fn get_build_state(&self) -> Result<Option<String>, GlobalStateError>
Gets the global state at build-time. If no function was registered to this, we’ll return None
.
Trait Implementations
sourceimpl Clone for GlobalStateCreator
impl Clone for GlobalStateCreator
sourcefn clone(&self) -> GlobalStateCreator
fn clone(&self) -> GlobalStateCreator
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for GlobalStateCreator
impl Debug for GlobalStateCreator
sourceimpl Default for GlobalStateCreator
impl Default for GlobalStateCreator
sourcefn default() -> GlobalStateCreator
fn default() -> GlobalStateCreator
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl !RefUnwindSafe for GlobalStateCreator
impl !Send for GlobalStateCreator
impl !Sync for GlobalStateCreator
impl Unpin for GlobalStateCreator
impl !UnwindSafe for GlobalStateCreator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more