8000 GitHub - rustne-kretser/critical-once-cell
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rustne-kretser/critical-once-cell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pipeline Crates.io API reference

critical-once-cell

Drop-in replacements for [core::lazy::OnceCell] and [core::lazy::Lazy], backed by [critical_section].

Examples

CriticalOnceCell

use critical_once_cell::CriticalOnceCell;

static CELL: CriticalOnceCell<String> = CriticalOnceCell::new();

fn main() {
    CELL.set("Hello, World!".to_owned()).unwrap();

    assert_eq!(*CELL.get().unwrap(), "Hello, World!");
}

CriticalLazy

use critical_once_cell::CriticalLazy;

static LAZY: CriticalLazy<String> = CriticalLazy::new(|| "Hello, World!".to_owned());

fn main() {
    assert_eq!(*LAZY, "Hello, World!");
}

For more details, see docs.

Usage

Add this to your Cargo.toml:

[dependencies]
critical-once-cell = "0.2.0"

License

MPL-2.0

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0