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

feat: add Send trait for GenVisitor #255

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 3 additions & 3 deletions schemars/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl SchemaSettings {
}

/// Appends the given visitor to the list of [visitors](SchemaSettings::visitors) for these `SchemaSettings`.
pub fn with_visitor(mut self, visitor: impl Visitor + Debug + Clone + 'static) -> Self {
pub fn with_visitor(mut self, visitor: impl GenVisitor + 'static) -> Self {
self.visitors.push(Box::new(visitor));
self
}
Expand Down Expand Up @@ -497,7 +497,7 @@ impl SchemaGenerator {
/// let v: &dyn GenVisitor = &MyVisitor;
/// assert!(v.as_any().is::<MyVisitor>());
/// ```
pub trait GenVisitor: Visitor + Debug + DynClone + Any {
pub trait GenVisitor: Visitor + Debug + DynClone + Send + Any {
/// Upcasts this visitor into an `Any`, which can be used to inspect and manipulate it as its concrete type.
fn as_any(&self) -> &dyn Any;
}
Expand All @@ -506,7 +506,7 @@ dyn_clone::clone_trait_object!(GenVisitor);

impl<T> GenVisitor for T
where
T: Visitor + Debug + Clone + Any,
T: Visitor + Debug + Clone + Send + Any,
{
fn as_any(&self) -> &dyn Any {
self
Expand Down
Loading