Skip to main content
Log in

Mojo struct

NoneType

@register_passable(trivial) struct NoneType

Represents the absence of a value.

Implemented traits

AnyType, CollectionElement, CollectionElementNew, Copyable, ExplicitlyCopyable, Movable, Representable, Stringable, UnknownDestructibility, Writable

Methods

__init__

__init__(out self)

Construct an instance of the None type.

__init__(out self, value: None)

Construct an instance of the None type.

Args:

  • value (None): The MLIR none type to construct from.

__init__(out self, *, other: Self)

Explicit copy constructor.

Args:

  • other (Self): Another NoneType instance to copy.

__str__

__str__(self) -> String

Returns the string representation of None.

Returns:

"None".

__repr__

__repr__(self) -> String

Returns the string representation of None.

Returns:

"None".

write_to

write_to[W: Writer](self, mut writer: W)

Write None to a writer stream.

Parameters:

  • W (Writer): A type conforming to the Writable trait.

Args:

  • writer (W): The object to write to.