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:
parent
88a4f50f77
commit
21daff2879
|
@ -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
|
||||
|
|
|
@ -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)* })
|
||||
}};
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue