Mojo struct
Origin
@register_passable(trivial)
struct Origin[*, mut: Bool]
This represents a origin reference for a memory value.
Parameters
- mut (
Bool): Whether the origin is mutable.
Implemented traits
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable
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
external
comptime external = origin_of()
An external origin of the given mutability. The external origin is guaranteed not to alias any existing origins.
An external origin implies there is no previously existing value that this origin aliases. Therefore, the compiler cannot track the origin or the value's lifecycle. The external origin is useful when interfacing with memory that comes from outside the current Mojo program.
Methods
__init__
@implicit
__init__(other: Origin[mut=mut]) -> ImmutOrigin
Allow converting an mutable origin to an immutable one.
Args:
- other (
Origin): The mutable origin to convert.
Returns:
__init__(*, unsafe_cast: Origin[mut=mut]) -> Self
Allow converting an mutable origin to an immutable one.
Args:
- unsafe_cast (
Origin): The mutable origin to convert.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!