Warning
This post was published 76 days ago. The information described in this article may have changed.
I got an error atomic loads cannot have "Release" or "AcqRel" ordering
in the code below:
use std::sync::atomic::{AtomicUsize, Ordering};
fn main() {
let counter = AtomicUsize::new(0);
println!("Result: {}", counter.load(Ordering::AcqRel));
}
I wonder if it's possible apply this on a custom Enum?
enum E1 {
A1,
A2,
A3,
}
// How to let compiler report error when pass constant value E1::A3?
fn some_function(v: E1) {
if let E1::A3 = v{
panic!("A3 not supported")
}
// do something
}
3 posts - 3 participants
🏷️ rust_feed