Adding in mixin_if method
This commit is contained in:
parent
b6eeabb398
commit
6fa0ac5d08
12
src/dom.rs
12
src/dom.rs
|
@ -449,7 +449,17 @@ impl<A> DomBuilder<A> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn mixin<B: Mixin<Self>>(self, mixin: B) -> Self {
|
pub fn mixin<B: Mixin<Self>>(self, mixin: B) -> Self {
|
||||||
mixin.apply(self)
|
self.mixin_if(true, mixin)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn mixin_if<B: Mixin<Self>>(self, test: bool, mixin: B) -> Self {
|
||||||
|
if test {
|
||||||
|
mixin.apply(self)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue