https://github.com/mkroening/call-once
A type that can only be called sucessfully once.
https://github.com/mkroening/call-once
no-std once rust sync synchronization
Last synced: 6 months ago
JSON representation
A type that can only be called sucessfully once.
- Host: GitHub
- URL: https://github.com/mkroening/call-once
- Owner: mkroening
- License: apache-2.0
- Created: 2023-08-28T14:42:37.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-04T16:56:16.000Z (about 2 years ago)
- Last Synced: 2025-04-14T20:16:01.106Z (6 months ago)
- Topics: no-std, once, rust, sync, synchronization
- Language: Rust
- Homepage: https://crates.io/crates/call-once
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# call-once
[](https://crates.io/crates/call-once)
[](https://docs.rs/call-once)
[](https://github.com/mkroening/call-once/actions/workflows/ci.yml)This crate provides [`CallOnce`], a simple, thread-safe type that can only be called successfully _once_:
```rust
use call_once::CallOnce;static CALL_ONCE: CallOnce = CallOnce::new();
assert!(CALL_ONCE.call_once().is_ok());
assert!(CALL_ONCE.call_once().is_err());
```[`CallOnce`]: https://docs.rs/call-once/latest/call_once/struct.CallOnce.html
For API documentation, see the [docs].
[docs]: https://docs.rs/call-once
## License
Licensed under either of
* Apache License, Version 2.0
([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license
([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)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.