System

System

Mojo trait 🡭

System

Trait for systems in the scheduler.

Implemented traits

AnyType, Copyable, ImplicitlyDeletable, Movable

Methods

Expand all   Collapse all

__init__

fn def __init__(out self: _Self, *, copy: _Self)

Create a new instance of the value by copying an existing one. Args:

  • copy (_Self): The value to copy.
  • self (_Self)

Returns:

_Self

fn def __init__(out self: _Self, *, deinit move: _Self)

Create a new instance of the value by moving the value of another. Args:

  • move (_Self): The value to move.
  • self (_Self)

Returns:

_Self

initialize

fn def initialize[*ComponentTypes: ComponentType](mut self: _Self, mut world: World[ComponentTypes])

Optionally initializes the system with the given world. Parameters:

  • *ComponentTypes (ComponentType): The component types in the world.

Args:

  • self (_Self)
  • world (World[ComponentTypes]): The world to use for initialization.

Raises:

update

fn def update[*ComponentTypes: ComponentType](mut self: _Self, mut world: World[ComponentTypes])

Updates the system with the given world. Parameters:

  • *ComponentTypes (ComponentType): The component types in the world.

Args:

  • self (_Self)
  • world (World[ComponentTypes]): The world to use for the update.

Raises:

finalize

fn def finalize[*ComponentTypes: ComponentType](mut self: _Self, mut world: World[ComponentTypes])

Optionally finalizes the system with the given world. Parameters:

  • *ComponentTypes (ComponentType): The component types in the world.

Args:

  • self (_Self)
  • world (World[ComponentTypes]): The world to use for the finalization.

Raises:

copy

fn def copy(self: _Self) -> _Self

Explicitly construct a copy of self, a convenience method for Self(copy=self) when the type is inconvenient to write out. Args:

  • self (_Self)

Returns:

_Self: A copy of this value.