Skip to main content

Mojo struct

Ordering

struct Ordering

Represents the memory ordering for atomic operations.

The class provides a set of constants that represent different memory orderings for atomic operations.

Attributes: NOT_ATOMIC: Not atomic. UNORDERED: Unordered. RELAXED: Relaxed. ACQUIRE: Acquire. RELEASE: Release. ACQUIRE_RELEASE: Acquire-release. SEQUENTIAL: Sequentially consistent.

Implemented traits

AnyType, Copyable, Equatable, ImplicitlyCopyable, ImplicitlyDestructible, Movable, RegisterPassable, TrivialRegisterPassable, Writable

comptime members

ACQUIRE

comptime ACQUIRE = Ordering(UInt8(3))

Acquire.

ACQUIRE_RELEASE

comptime ACQUIRE_RELEASE = Ordering(UInt8(5))

Acquire-release.

NOT_ATOMIC

comptime NOT_ATOMIC = Ordering(UInt8(0))

Not atomic.

RELAXED

comptime RELAXED = Ordering(UInt8(2))

Relaxed.

RELEASE

comptime RELEASE = Ordering(UInt8(4))

Release.

SEQUENTIAL

comptime SEQUENTIAL = Ordering(UInt8(6))

Sequentially consistent.

UNORDERED

comptime UNORDERED = Ordering(UInt8(1))

Unordered.

Methods

__init__

__init__(value: UInt8) -> Self

Constructs a new Ordering object.

Args:

  • value (UInt8): The value of the memory ordering.

__eq__

__eq__(self, other: Self) -> Bool

Compares two Ordering objects for equality.

Args:

  • other (Self): The other Ordering object to compare with.

Returns:

Bool: True if the objects are equal, False otherwise.

__ne__

__ne__(self, other: Self) -> Bool

Compares two Ordering objects for inequality.

Args:

  • other (Self): The other Ordering object to compare with.

Returns:

Bool: True if the objects are not equal, False otherwise.

as_string_slice

as_string_slice(self) -> StaticString

Returns a string slice representation of an Ordering.

Returns:

StaticString: A string slice representation of this ordering.

write_to

write_to(self, mut writer: T)

Write the string representation of this Ordering to a writer.

Args:

  • writer (T): The object to write to.

write_repr_to

write_repr_to(self, mut writer: T)

Write the repr of this Ordering to a writer.

Args:

  • writer (T): The object to write to.

Was this page helpful?