Trait yewtil::NeqAssign[][src]

pub trait NeqAssign<NEW> {
    fn neq_assign(&mut self, new: NEW) -> ShouldRender;
Expand description

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[src]

Expand description

If self and new aren’t equal, assigns new to self and returns true, otherwise returns false.

Short for “Not equal assign”.


#[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{

let mut foo = 1;

assert_eq!(foo.neq_assign(42), true);
assert_eq!(foo, 42);

assert_eq!(foo.neq_assign(42), false);
Loading content...


impl<T: BorrowMut<U>, U: PartialEq> NeqAssign<U> for T[src]

fn neq_assign(&mut self, new: U) -> bool[src]

Loading content...