toasty_driver_integration_suite/tests/
infra_sync_send.rs

1use crate::prelude::*;
2
3fn assert_sync_send<T: Send>(val: T) -> T {
4    val
5}
6
7fn assert_send_sync<T: Send + Sync>() {}
8
9#[driver_test(id(ID), scenario(crate::scenarios::user_unique_email))]
10pub async fn ensure_types_sync_send(t: &mut Test) -> Result<()> {
11    let mut db = setup(t).await;
12
13    let res = assert_sync_send(
14        User::filter_by_email("hello@example.com")
15            .first()
16            .exec(&mut db),
17    )
18    .await?;
19
20    if let Some(user) = res {
21        assert_eq!(user.email, "hello@example.com");
22    }
23
24    // Ensure Assignment types are Send + Sync (regression test)
25    assert_send_sync::<toasty::stmt::Assignment<String>>();
26    assert_send_sync::<toasty::stmt::Assignment<i64>>();
27    assert_send_sync::<toasty::stmt::Assignment<toasty::stmt::List<String>>>();
28
29    Ok(())
30}