Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shape plan Send and Sync #90

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>();
}
}
Loading