For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
unsafe_pointer
Defines UnsafePointer and related aliases as backward-compatible names for Pointer.
UnsafePointer is a comptime alias for Pointer, kept for code written
before the two pointer types were unified. Prefer Pointer directly in new
code; see std.memory.pointer for the type's docstring and its unsafe_
method surface.
comptime values
ImmUnsafePointer
comptime ImmUnsafePointer[T: AnyType, origin: ImmOrigin, *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]
An immutable unsafe pointer.
Deprecated: 'ImmUnsafePointer' is deprecated, use 'ImmPointer' instead
Parameters
- T (
AnyType): The pointee type. - origin (
ImmOrigin): The origin of the pointer. - address_space (
AddressSpace): The address space of the pointer.
MutUnsafePointer
comptime MutUnsafePointer[T: AnyType, origin: MutOrigin, *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]
A mutable unsafe pointer.
Deprecated: 'MutUnsafePointer' is deprecated, use 'MutPointer' instead
Parameters
- T (
AnyType): The pointee type. - origin (
MutOrigin): The origin of the pointer. - address_space (
AddressSpace): The address space of the pointer.
OptionalUnsafePointer
comptime OptionalUnsafePointer[mut: Bool, //, T: AnyType, origin: Origin[mut=mut], *, address_space: AddressSpace = AddressSpace.GENERIC] = Optional[Pointer[T, origin, address_space=address_space]]
An optional (nullable) UnsafePointer.
Deprecated: 'OptionalUnsafePointer' is deprecated, use 'OptionalPointer' instead
Parameters
- mut (
Bool): The mutability of the pointer. - T (
AnyType): The type of the pointee. - origin (
Origin[mut=mut]): The origin of the pointer. - address_space (
AddressSpace): The address space of the pointer.
UnsafePointer
comptime UnsafePointer[mut: Bool, //, T: AnyType, origin: Origin[mut=mut], *, address_space: AddressSpace = AddressSpace.GENERIC] = Pointer[T, origin, address_space=address_space]
An indirect reference to one or more values of T consecutively in memory, and can refer to uninitialized memory.
Deprecated: 'UnsafePointer' is deprecated, use 'Pointer' instead
Parameters
- mut (
Bool): Whether the pointer is mutable. - T (
AnyType): The type the pointer points to. - origin (
Origin[mut=mut]): The origin of the memory being addressed. - address_space (
AddressSpace): The address space of the pointer.