Adding in mixin_if method

This commit is contained in:
Pauan 2018-10-29 20:57:47 -10:00
parent b6eeabb398
commit 6fa0ac5d08
1 changed files with 11 additions and 1 deletions

View File

@ -449,7 +449,17 @@ impl<A> DomBuilder<A> {
#[inline]
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
}
}
}