Skip to content

Commit

Permalink
Make shape plan Send and Sync.
Browse files Browse the repository at this point in the history
  • Loading branch information
laurmaedje authored Dec 6, 2023
1 parent eee0919 commit 5c537c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/complex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub struct ComplexShaper {

/// Called at the end of `shape_plan()`.
/// Whatever shapers return will be accessible through `plan.data()` later.
pub create_data: Option<fn(&ShapePlan) -> Box<dyn Any>>,
pub create_data: Option<fn(&ShapePlan) -> Box<dyn Any + Send + Sync>>,

/// Called during `shape()`.
/// Shapers can use to modify text before shaping starts.
Expand Down
13 changes: 12 additions & 1 deletion src/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub struct ShapePlan {
pub(crate) shaper: &'static ComplexShaper,
pub(crate) ot_map: ot::Map,
pub(crate) aat_map: aat::Map,
data: Option<Box<dyn Any>>,
data: Option<Box<dyn Any + Send + Sync>>,

pub(crate) frac_mask: Mask,
pub(crate) numr_mask: Mask,
Expand Down Expand Up @@ -363,3 +363,14 @@ impl<'a> ShapePlanner<'a> {
plan
}
}

#[cfg(test)]
mod tests {
use super::ShapePlan;

#[test]
fn test_shape_plan_is_send_and_sync() {
fn ensure_send_and_sync<T: Send + Sync>() {}
ensure_send_and_sync::<ShapePlan>();
}
}

0 comments on commit 5c537c6

Please sign in to comment.