pub struct WidgetTemplate {
pub id: Option<String>,
pub is_root: bool,
pub as_prop: Option<String>,
pub is_static: bool,
pub ty: WidgetType,
pub children: Option<Vec<WidgetTemplate>>,
pub role: Role,
pub binds: Option<HashMap<String, String>>,
}Expand description
§通用Widget模型
这个Widget模型主要用于抽象整个Makepad Widget结构
Fields§
§id: Option<String>虽然这里是Option,但是在生成代码的时候,这个id是自动填充的,见[utils::Ulid]
is_root: bool§as_prop: Option<String>§is_static: bool§ty: WidgetType§children: Option<Vec<WidgetTemplate>>§role: Role§binds: Option<HashMap<String, String>>Implementations§
Source§impl WidgetTemplate
impl WidgetTemplate
pub fn is_global(&self) -> bool
pub fn root_name(&self) -> TokenStream
pub fn is_define_root_and<F, R>(&self, f: F) -> Option<R>where
F: FnOnce(&DefineWidget) -> R,
pub fn to_token_stream( &self, ptrs: Option<&Vec<WidgetTemplate>>, ) -> Result<TokenStream, Error>
pub fn ptr_to_token_stream( ptrs: Option<&Vec<WidgetTemplate>>, ) -> Option<TokenStream>
pub fn live_node(&self, ptrs: Option<&Vec<WidgetTemplate>>) -> TokenStream
Trait Implementations§
Source§impl Clone for WidgetTemplate
impl Clone for WidgetTemplate
Source§fn clone(&self) -> WidgetTemplate
fn clone(&self) -> WidgetTemplate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WidgetTemplate
impl Debug for WidgetTemplate
Auto Trait Implementations§
impl Freeze for WidgetTemplate
impl RefUnwindSafe for WidgetTemplate
impl Send for WidgetTemplate
impl Sync for WidgetTemplate
impl Unpin for WidgetTemplate
impl UnsafeUnpin for WidgetTemplate
impl UnwindSafe for WidgetTemplate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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