IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: Nightly
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).

movable

Defines Movable, the trait for types whose value can be moved.

This is a Mojo built-in, so you don't need to import it.

comptime values

IsTriviallyMovable

comptime IsTriviallyMovable[T: AnyType] = conforms_to(T, TrivialRegisterPassable) if conforms_to(T, TrivialRegisterPassable) else T.__move_ctor_is_trivial if conforms_to(T, Movable) else conforms_to(T, Movable)

Indicates whether T is Movable with a trivial move initializer.

A move initializer is trivial when the compiler generates it and all of T's fields are themselves trivially movable — the value can be moved by copying its bits to a new location with no additional side effects. Evaluates to False for non-Movable types.

Parameters

  • T (AnyType): The type to check.

Traits

  • Movable: The Movable trait denotes a type whose value can be moved.