pub struct DataView(/* private fields */);Expand description
W Dynamically presents a data variable.
§Shorthand
The DataView! macro provides a shorthand init that sets view property directly.
DataView!(::<T>, data, update)Note that the first argument is a turbo-fish that defines the data type and is required.
The shorthand is above expands to:
DataView! {
view::<T> = {
data: data,
update: update,
};
}Implementations§
Source§impl DataView
impl DataView
Sourcepub fn widget_new() -> DataView
pub fn widget_new() -> DataView
Start building a new instance.
Sourcepub fn widget_type() -> WidgetType
pub fn widget_type() -> WidgetType
Gets the widget type info.
Source§impl DataView
impl DataView
Sourcepub fn padding(&self, padding: impl IntoVar<SideOffsets>)
pub fn padding(&self, padding: impl IntoVar<SideOffsets>)
P Spacing around content, inside the border.
Sourcepub fn child_align(&self, align: impl IntoVar<Align>)
pub fn child_align(&self, align: impl IntoVar<Align>)
P Content alignment.
Sourcepub fn clip_to_bounds(&self, clip: impl IntoVar<bool>)
pub fn clip_to_bounds(&self, clip: impl IntoVar<bool>)
P Content overflow clipping.
Source§impl DataView
impl DataView
Sourcepub fn view<D>(
&self,
data: impl IntoVar<D>,
update: Box<dyn FnMut(&DataViewArgs<D>) -> HandlerResult + Send>,
)where
D: VarValue,
pub fn view<D>(
&self,
data: impl IntoVar<D>,
update: Box<dyn FnMut(&DataViewArgs<D>) -> HandlerResult + Send>,
)where
D: VarValue,
P The view generator.
The update widget handler is used to generate the view from the data, it is called on init and
every time data or update are new. The view is set by calling DataViewArgs::set_view in the widget function
args, note that the data variable is available in DataViewArgs::data, a good view will bind to the variable
to support some changes, only replacing the view for major changes.
Methods from Deref<Target = WidgetBase>§
Sourcepub fn widget_builder(&mut self) -> &mut WidgetBuilder
pub fn widget_builder(&mut self) -> &mut WidgetBuilder
Returns a mutable reference to the widget builder.
Sourcepub fn widget_when(&mut self) -> Option<&mut WhenInfo>
pub fn widget_when(&mut self) -> Option<&mut WhenInfo>
Returns a mutable reference to the when block if called inside a when block.
Sourcepub fn widget_take(&mut self) -> WidgetBuilder
pub fn widget_take(&mut self) -> WidgetBuilder
Takes the widget builder, finishing the widget macro build.
After this call trying to set a property using self will panic,
the returned builder can still be manipulated directly.
Sourcepub fn widget_build(&mut self) -> UiNode
pub fn widget_build(&mut self) -> UiNode
Build the widget.
After this call trying to set a property will panic.
Sourcepub fn widget_importance(&mut self) -> &mut Importance
pub fn widget_importance(&mut self) -> &mut Importance
Returns a mutable reference to the importance of the next property assigns, unsets or when blocks.
Note that during the widget_intrinsic call this is Importance::WIDGET and after it is Importance::INSTANCE.
Sourcepub fn start_when_block(
&mut self,
inputs: Box<[WhenInput]>,
state: Var<bool>,
expr: &'static str,
location: SourceLocation,
)
pub fn start_when_block( &mut self, inputs: Box<[WhenInput]>, state: Var<bool>, expr: &'static str, location: SourceLocation, )
Start building a when block, all properties set after this call are pushed in the when block.
Sourcepub fn end_when_block(&mut self)
pub fn end_when_block(&mut self)
End the current when block, all properties set after this call are pushed in the widget.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for DataView
impl !RefUnwindSafe for DataView
impl Send for DataView
impl !Sync for DataView
impl !Unpin for DataView
impl !UnwindSafe for DataView
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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