[−][src]Trait yewtil::NeqAssign
Blanket trait to provide a convenience method for assigning props in changed
or updating values in update
.
Required methods
fn neq_assign(&mut self, new: NEW) -> ShouldRender
If self
and new
aren't equal, assigns new
to self
and returns true, otherwise returns false.
Short for "Not equal assign".
Example
#[derive(Clone, Properties, PartialEq)] struct Props { field1: String, field2: usize } struct Model { props: Props } impl Component for Model { type Properties = Props; // ... fn change(&mut self, props: Self::Properties) -> ShouldRender{ self.props.neq_assign(props) } }