sel4_shared_memory/atomic_ops/
ordering.rs

1//
2// Copyright 2023, Colias Group, LLC
3//
4// SPDX-License-Identifier: MIT OR Apache-2.0
5//
6
7use core::sync::atomic::Ordering;
8
9pub(crate) enum OrderingExhaustive {
10    Relaxed,
11    Release,
12    Acquire,
13    AcqRel,
14    SeqCst,
15}
16
17impl From<OrderingExhaustive> for Ordering {
18    fn from(order: OrderingExhaustive) -> Self {
19        match order {
20            OrderingExhaustive::Relaxed => Self::Relaxed,
21            OrderingExhaustive::Release => Self::Release,
22            OrderingExhaustive::Acquire => Self::Acquire,
23            OrderingExhaustive::AcqRel => Self::AcqRel,
24            OrderingExhaustive::SeqCst => Self::SeqCst,
25        }
26    }
27}
28
29impl From<Ordering> for OrderingExhaustive {
30    fn from(order: Ordering) -> Self {
31        match order {
32            Ordering::Relaxed => Self::Relaxed,
33            Ordering::Release => Self::Release,
34            Ordering::Acquire => Self::Acquire,
35            Ordering::AcqRel => Self::AcqRel,
36            Ordering::SeqCst => Self::SeqCst,
37            _ => panic!(),
38        }
39    }
40}