From 2ee5810fecb96a8d4e0d078faecc8c91096d6881 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 6 Jan 2020 12:41:42 +0100 Subject: =?UTF-8?q?Asyncify=20font=20loading=20=F0=9F=AA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/func/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/func/mod.rs') diff --git a/src/func/mod.rs b/src/func/mod.rs index 427e5b6f..a0875cf9 100644 --- a/src/func/mod.rs +++ b/src/func/mod.rs @@ -4,6 +4,7 @@ use std::any::Any; use std::collections::HashMap; use std::fmt::{self, Debug, Formatter}; +use async_trait::async_trait; use self::prelude::*; #[macro_use] @@ -24,6 +25,7 @@ pub mod prelude { pub use Command::*; } + /// Types representing functions that are parsed from source code. pub trait ParseFunc { type Meta: Clone; @@ -43,12 +45,13 @@ pub trait ParseFunc { /// The trait `[LayoutFuncBounds]` is automatically implemented for types which /// can be used as functions, that is, all types which fulfill the bounds `Debug /// + PartialEq + 'static`. +#[async_trait(?Send)] pub trait LayoutFunc: LayoutFuncBounds { /// Layout this function in a given context. /// /// Returns a sequence of layouting commands which describe what the /// function is doing. - fn layout(&self, ctx: LayoutContext) -> LayoutResult; + async fn layout<'a>(&'a self, ctx: LayoutContext<'_, '_>) -> LayoutResult>; } impl dyn LayoutFunc { -- cgit v1.2.3