pub struct Snapshot<'f, T: 'static> { /* private fields */ }Expand description
Like PageState, but kept when the user navigates away and restored when they come
back with back/forward.
Use it for UI state worth getting back, such as a half-typed search or a draft. A new
navigation to the page (a link, goto) starts over with T::default(). Snapshots are kept
in memory, so a browser reload or an app restart loses them; see
PersistentState for state that survives those.
use egui::Ui;
use egui_kit::extract::Snapshot;
#[derive(Default)]
struct Search {
text: String,
}
fn view(ui: &mut Ui, mut search: Snapshot<Search>) {
ui.text_edit_singleline(&mut search.text);
}Trait Implementations§
Auto Trait Implementations§
impl<'f, T> !RefUnwindSafe for Snapshot<'f, T>
impl<'f, T> !Send for Snapshot<'f, T>
impl<'f, T> !Sync for Snapshot<'f, T>
impl<'f, T> !UnwindSafe for Snapshot<'f, T>
impl<'f, T> Forget for Snapshot<'f, T>
impl<'f, T> Freeze for Snapshot<'f, T>
impl<'f, T> Move for Snapshot<'f, T>
impl<'f, T> Unpin for Snapshot<'f, T>
impl<'f, T> UnsafeUnpin for Snapshot<'f, T>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more