Changing apply_methods/html/svg to run each method call on a separate statement

This means that any locks will be freed at the end of the method call
This commit is contained in:
Pauan 2021-05-17 09:42:35 +02:00
parent 88a4f50f77
commit 21daff2879
2 changed files with 13 additions and 13 deletions

View File

@ -621,7 +621,7 @@ struct MutableAnimationState {
playing: bool,
duration: f64,
end: Percentage,
animating: Option<OnTimestampDiff>,
_animating: Option<OnTimestampDiff>,
}
struct MutableAnimationInner {
@ -661,7 +661,7 @@ impl MutableAnimation {
playing: true,
duration: duration,
end: initial,
animating: None,
_animating: None,
}),
value: Mutable::new(initial),
}),
@ -682,7 +682,7 @@ impl MutableAnimation {
#[inline]
fn stop_animating(lock: &mut MutableAnimationState) {
lock.animating = None;
lock._animating = None;
}
fn start_animating(&self, lock: &mut MutableAnimationState) {
@ -697,7 +697,7 @@ impl MutableAnimation {
let state = self.raw_clone();
lock.animating = Some(OnTimestampDiff::new(move |diff| {
lock._animating = Some(OnTimestampDiff::new(move |diff| {
let diff = diff / duration;
// TODO test the performance of set_neq

View File

@ -3,15 +3,15 @@ macro_rules! apply_methods {
($this:expr, {}) => {
$this
};
($this:expr, { .$name:ident!($($args:tt)*) $($rest:tt)* }) => {
$crate::apply_methods!({
let this = $this;
$name!(this, $($args)*)
}, { $($rest)* })
};
($this:expr, { .$name:ident($($args:expr),*) $($rest:tt)* }) => {
$crate::apply_methods!($this.$name($($args),*), { $($rest)* })
};
($this:expr, { .$name:ident!($($args:tt)*) $($rest:tt)* }) => {{
let this = $this;
let this = $name!(this, $($args)*);
$crate::apply_methods!(this, { $($rest)* })
}};
($this:expr, { .$name:ident($($args:expr),*) $($rest:tt)* }) => {{
let this = $this.$name($($args),*);
$crate::apply_methods!(this, { $($rest)* })
}};
}