Skip to main content

Mojo struct

Origin

struct Origin[mut: Bool, _mlir_origin: LITOrigin[mut], //]

This represents a origin reference for a memory value.

Parameters

  • mut (Bool): Whether the origin is mutable.
  • _mlir_origin (LITOrigin): The raw MLIR origin value.

Implemented traits

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

Methods

__init__

__init__() -> Self

Construct an Origin.

@implicit __init__(v: Origin[mut=v.mut]) -> ImmutOrigin

Implicitly convert an origin to an immutable one.

Args:

  • v (Origin): The origin to convert.

Returns:

ImmutOrigin

unsafe_mut_cast

static unsafe_mut_cast[dest_mut: Bool]() -> Origin[mut=dest_mut]

Cast this origin to a different mutability, potentially introducing more mutability, which is an unsafe operation.

Parameters:

  • dest_mut (Bool): The desired mutability of the resulting origin.

Returns:

Origin: The same origin but with a new specified mutability.

Was this page helpful?