summaryrefslogtreecommitdiff
path: root/src/func
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-10-30 22:52:25 +0100
committerLaurenz <laurmaedje@gmail.com>2019-10-30 22:52:25 +0100
commit65ec3764e59353995a4feaa4214aea8c3e59bc3a (patch)
tree66c97b641854770f3551deafd159afffbdc51fb4 /src/func
parentb5d8b8f4a5425ec7bcaa50d8394e76cffe4baadc (diff)
Basic node spans ✅
Diffstat (limited to 'src/func')
-rw-r--r--src/func/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/func/mod.rs b/src/func/mod.rs
index b3918253..30b5b825 100644
--- a/src/func/mod.rs
+++ b/src/func/mod.rs
@@ -42,6 +42,13 @@ pub trait Function: FunctionBounds {
fn layout(&self, ctx: LayoutContext) -> LayoutResult<CommandList>;
}
+impl dyn Function {
+ /// Downcast a dynamic function to a concrete function type.
+ pub fn downcast<F>(&self) -> Option<&F> where F: Function + 'static {
+ self.help_cast_as_any().downcast_ref::<F>()
+ }
+}
+
impl PartialEq for dyn Function {
fn eq(&self, other: &dyn Function) -> bool {
self.help_eq(other)