Skip to main content

Mojo struct

Origin

@register_passable(trivial) struct Origin[mut: Bool, //, _mlir_origin: LITOrigin[mut._mlir_value]]

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

comptime members

__copyinit__is_trivial

comptime __copyinit__is_trivial = True

__del__is_trivial

comptime __del__is_trivial = True

__moveinit__is_trivial

comptime __moveinit__is_trivial = True

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

__init__(*, unsafe_mut_cast: Origin[mut=unsafe_mut_cast.mut]) -> Origin[mut=mut]

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

Args:

  • unsafe_mut_cast (Origin): The origin to cast.

Returns:

Origin

Was this page helpful?