Skip to content

Commit

Permalink
refactor(lib): move request and response trait bound assertion to test
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto authored and seanmonstar committed Feb 16, 2024
1 parent dac3dd9 commit fb90063
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,19 @@ pub use crate::status::StatusCode;
pub use crate::uri::Uri;
pub use crate::version::Version;

fn _assert_types() {
fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}
#[cfg(test)]
mod tests {
use super::*;

fn assert_send_sync<T: Send + Sync>() {}

assert_send::<Request<()>>();
assert_send::<Response<()>>();
#[test]
fn request_satisfies_send_sync() {
assert_send_sync::<Request<()>>();
}

assert_sync::<Request<()>>();
assert_sync::<Response<()>>();
#[test]
fn response_satisfies_send_sync() {
assert_send_sync::<Response<()>>();
}
}

0 comments on commit fb90063

Please sign in to comment.