#send-sync #static #basic #marking #sss #future #traits

send-sync-static

This crate fulfills the simple purpose of marking a type as Send, Sync, and 'static

1 stable release

1.0.0 Oct 8, 2023

#2377 in Rust patterns

Download history 1/week @ 2024-02-18 10/week @ 2024-02-25 48/week @ 2024-03-10 2/week @ 2024-03-17 14/week @ 2024-03-31

64 downloads per month

Apache-2.0

6KB

send-sync-static

A very very basic crate, whose only purpose is to allow marking types Send + Sync + 'static. No dependencies, no nothing. That's it.

Usage

The SSS trait is a shortcut for Send + Sync + 'static. Use it to mark a type as fulfilling these requirements. E.g.

pub async fn send_data<D>(data: D) where D: SSS {
   // Do something here
}

You can also use FutureSSS which is simply a shorthand for Future + SSS.

pub fn send_data<D: SSS>(data: D) -> impl FutureSSS {
   // Guarantees the async block is always Send, Sync, and 'static
    async move { 
        // Do something here
        drop(data)
    }
}

License

Apache 2.0. This crate has so little code, it might not even be licensable.


lib.rs:

A very basic crate, whose only purpose is to allow marking types Send, Sync, and 'static

No runtime deps