pub struct PageStateStore { /* private fields */ }
Expand description

A container for page state in Perseus. This is designed as a context store, in which one of each type can be stored. Therefore, it acts very similarly to Sycamore’s context system, though it’s specifically designed for each page to store one reactive properties object. In theory, you could interact with this entirely independently of Perseus’ state interface, though this isn’t recommended.

Note that the same pages in different locales will have different entries here. If you need to store state for a page across locales, you should use the global state system instead. For apps not using i18n, the page URL will not include any locale.

Implementations

Gets an element out of the state by its type and URL. If the element stored for the given URL doesn’t match the provided type, None will be returned.

Adds a new element to the state by its URL. Any existing element with the same URL will be silently overriden (use .contains() to check first if needed).

Checks if the state contains an entry for the given URL.

Freezes the component entries into a new HashMap of Strings to avoid extra layers of deserialization.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.