Skip to main content

Mojo struct

Consistency

struct Consistency

Represents the consistency model for atomic operations.

The class provides a set of constants that represent different consistency models for atomic operations.

Attributes: NOT_ATOMIC: Not atomic. UNORDERED: Unordered. MONOTONIC: Monotonic. 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 = Consistency(SIMD(3))

Acquire.

ACQUIRE_RELEASE

comptime ACQUIRE_RELEASE = Consistency(SIMD(5))

Acquire-release.

MONOTONIC

comptime MONOTONIC = Consistency(SIMD(2))

Monotonic.

NOT_ATOMIC

comptime NOT_ATOMIC = Consistency(SIMD(0))

Not atomic.

RELEASE

comptime RELEASE = Consistency(SIMD(4))

Release.

SEQUENTIAL

comptime SEQUENTIAL = Consistency(SIMD(6))

Sequentially consistent.

UNORDERED

comptime UNORDERED = Consistency(SIMD(1))

Unordered.

Methods

__init__

__init__(value: UInt8) -> Self

Constructs a new Consistency object.

Args:

  • value (UInt8): The value of the consistency model.

__eq__

__eq__(self, other: Self) -> Bool

Compares two Consistency objects for equality.

Args:

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

Returns:

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

__ne__

__ne__(self, other: Self) -> Bool

Compares two Consistency objects for inequality.

Args:

  • other (Self): The other Consistency 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 a Consistency.

Returns:

StaticString: A string slice representation of this consistency.

write_to

write_to(self, mut writer: T)

Write the string representation of this Consistency 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 Consistency to a writer.

Args:

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

Was this page helpful?