Skip to content

Commit

Permalink
Make the SendTarget trait a public trait (#633)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAwiteb authored Jan 13, 2024
1 parent 1405841 commit 7ec8f1a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/core/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ mod client;
mod request;
mod response;
pub use client::TestClient;
pub use request::RequestBuilder;
pub use request::{RequestBuilder, SendTarget};
pub use response::ResponseExt;
3 changes: 3 additions & 0 deletions crates/core/src/test/request/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,11 @@ impl RequestBuilder {
target.call(self.build()).await
}
}

/// Trait for sending request to target, such as [`Router`], [`Service`], [`Handler`]. for test usage.
#[async_trait]
pub trait SendTarget {
/// Send request to target, such as [`Router`], [`Service`], [`Handler`].
#[must_use = "future must be used"]
async fn call(self, req: Request) -> Response;
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/test/request/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
mod builder;

pub use builder::RequestBuilder;
pub use builder::{RequestBuilder, SendTarget};

0 comments on commit 7ec8f1a

Please sign in to comment.