pub struct PageStateFrom<'f, T: 'static> { /* private fields */ }Expand description
Like PageState, but created from the view’s data (what its load returned) with
T::from(&data), the first time it is extracted.
use egui::Ui;
use egui_kit::extract::PageStateFrom;
struct Post {
title: String,
}
struct Form {
title: String,
}
impl From<&Post> for Form {
fn from(post: &Post) -> Self {
Self { title: post.title.clone() }
}
}
fn edit(ui: &mut Ui, post: &Post, mut form: PageStateFrom<Form>) {
ui.label(format!("Editing {}", post.title));
ui.text_edit_singleline(&mut form.title);
}It shares its value with a PageState of the same type.
Trait Implementations§
Source§impl<T: Debug> Debug for PageStateFrom<'_, T>
impl<T: Debug> Debug for PageStateFrom<'_, T>
Source§impl<T> Deref for PageStateFrom<'_, T>
impl<T> Deref for PageStateFrom<'_, T>
Source§impl<T> DerefMut for PageStateFrom<'_, T>
impl<T> DerefMut for PageStateFrom<'_, T>
Source§impl<T> Drop for PageStateFrom<'_, T>
impl<T> Drop for PageStateFrom<'_, T>
Source§impl<S: 'static, D: 'static, T> FromView<S, D> for PageStateFrom<'_, T>
impl<S: 'static, D: 'static, T> FromView<S, D> for PageStateFrom<'_, T>
type Item<'f> = PageStateFrom<'f, T>
fn from_view<'f>(cx: &'f ViewContext<'_, S>) -> PageStateFrom<'f, T>
Auto Trait Implementations§
impl<'f, T> !RefUnwindSafe for PageStateFrom<'f, T>
impl<'f, T> !Send for PageStateFrom<'f, T>
impl<'f, T> !Sync for PageStateFrom<'f, T>
impl<'f, T> !UnwindSafe for PageStateFrom<'f, T>
impl<'f, T> Forget for PageStateFrom<'f, T>
impl<'f, T> Freeze for PageStateFrom<'f, T>
impl<'f, T> Move for PageStateFrom<'f, T>
impl<'f, T> Unpin for PageStateFrom<'f, T>
impl<'f, T> UnsafeUnpin for PageStateFrom<'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