Skip to content

Commit

Permalink
make resolution Send + Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed Nov 7, 2024
1 parent 43001f1 commit 5e9ccd6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/xdid-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub trait Method: Send + Sync {
fn resolve(
&self,
did: Did,
) -> Pin<Box<dyn Future<Output = Result<document::Document, ResolutionError>>>>;
) -> Pin<Box<dyn Future<Output = Result<document::Document, ResolutionError>> + Send + Sync>>;
}

#[derive(Error, Debug)]
Expand Down
9 changes: 7 additions & 2 deletions crates/xdid-method-key/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ impl Method for MethodDidKey {
fn resolve(
&self,
did: Did,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Document, ResolutionError>>>>
{
) -> std::pin::Pin<
Box<
dyn std::future::Future<Output = Result<xdid_core::document::Document, ResolutionError>>
+ Send
+ Sync,
>,
> {
debug_assert_eq!(did.method_name.0, self.method_name());

Box::pin(async move {
Expand Down
9 changes: 7 additions & 2 deletions crates/xdid-method-web/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@ impl Method for MethodDidWeb {
fn resolve(
&self,
did: Did,
) -> std::pin::Pin<Box<dyn std::future::Future<Output = Result<Document, ResolutionError>>>>
{
) -> std::pin::Pin<
Box<
dyn std::future::Future<Output = Result<xdid_core::document::Document, ResolutionError>>
+ Send
+ Sync,
>,
> {
debug_assert_eq!(did.method_name.0, self.method_name());

let client = self.client.clone();
Expand Down

0 comments on commit 5e9ccd6

Please sign in to comment.