#once #called #call #thread-safe #sync #api #sucessfully

no-std call-once

A type that can only be called sucessfully once

1 unstable release

0.1.0 Aug 28, 2023

#29 in #called

Download history 279/week @ 2024-01-04 373/week @ 2024-01-11 507/week @ 2024-01-18 464/week @ 2024-01-25 561/week @ 2024-02-01 569/week @ 2024-02-08 722/week @ 2024-02-15 658/week @ 2024-02-22 605/week @ 2024-02-29 540/week @ 2024-03-07 510/week @ 2024-03-14 702/week @ 2024-03-21 410/week @ 2024-03-28 1342/week @ 2024-04-04 855/week @ 2024-04-11 891/week @ 2024-04-18

3,616 downloads per month
Used in take-static

MIT/Apache

7KB

call-once

Crates.io docs.rs CI

This crate provides CallOnce, a simple, thread-safe type that can only be called successfully once:

use call_once::CallOnce;

static CALL_ONCE: CallOnce = CallOnce::new();

assert!(CALL_ONCE.call_once().is_ok());
assert!(CALL_ONCE.call_once().is_err());

For API documentation, see the docs.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps