diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-01-28 15:35:56 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-01-28 15:36:32 +0100 |
| commit | 4809e685a231a3ade2c78b75685ee859196c38c1 (patch) | |
| tree | e3141236cca536c31c6ef4a6df6d218c16ba5a94 /src/model/content.rs | |
| parent | 28c554ec2185a15e22f0408ce485ed4afe035e03 (diff) | |
More capable math calls
Diffstat (limited to 'src/model/content.rs')
| -rw-r--r-- | src/model/content.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/model/content.rs b/src/model/content.rs index df910a58..143f97aa 100644 --- a/src/model/content.rs +++ b/src/model/content.rs @@ -183,12 +183,18 @@ impl Content { } /// Whether the contained node is of type `T`. - pub fn is<T: 'static>(&self) -> bool { + pub fn is<T>(&self) -> bool + where + T: Capable + 'static, + { (*self.obj).as_any().is::<T>() } /// Cast to `T` if the contained node is of type `T`. - pub fn to<T: 'static>(&self) -> Option<&T> { + pub fn to<T>(&self) -> Option<&T> + where + T: Capable + 'static, + { (*self.obj).as_any().downcast_ref::<T>() } |
