struct
Reference
Defines a non-nullable safe reference.
Parameters
- type (
AnyType
): Type of the underlying data. - is_mutable (
Bool
): Whether the referenced data may be mutated through this. - lifetime (
lifetime<#lit.struct.extract<:_stdlib::_builtin::_bool::_Bool is_mutable, "value">>
): The lifetime of the reference. - address_space (
AddressSpace
): The address space of the referenced data.
Fields
- value (
!lit.ref<:trait<@stdlib::@builtin::@anytype::@AnyType> *"type", mut=#lit.struct.extract<:@stdlib::@builtin::@bool::@Bool is_mutable, "value">, lifetime, #lit.struct.extract<:@stdlib::@builtin::@int::@Int #lit.struct.extract<:@stdlib::@memory::@reference::@AddressSpace address_space, "_value">, "value">>
): The underlying MLIR reference.
Implemented traits
AnyType
,
Copyable
,
Movable
Methods
__init__
__init__(inout self: Self, value: !lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> *"type", mut=#lit.struct.extract<:_stdlib::_builtin::_bool::_Bool is_mutable, "value">, lifetime, #lit.struct.extract<:_stdlib::_builtin::_int::_Int #lit.struct.extract<:_stdlib::_memory::_reference::_AddressSpace address_space, "_value">, "value">>)
Constructs a Reference from the MLIR reference.
Args:
- value (
!lit.ref<:trait<_stdlib::_builtin::_anytype::_AnyType> *"type", mut=#lit.struct.extract<:_stdlib::_builtin::_bool::_Bool is_mutable, "value">, lifetime, #lit.struct.extract<:_stdlib::_builtin::_int::_Int #lit.struct.extract<:_stdlib::_memory::_reference::_AddressSpace address_space, "_value">, "value">>
): The MLIR reference.
__getitem__
__getitem__(self: Self) -> ref [lifetime] type
Enable subscript syntax ref[]
to access the element.
Returns:
The MLIR reference for the Mojo compiler to use.