Mojo struct
AnyMojoValue
Type erased representation of a mojo object. This is useful for passing opaque type as input for graph executution.
CAUTION: Experimental API.
Aliasesβ
c_type = _CMojoValue
:
Implemented traitsβ
AnyType
,
CollectionElement
,
Copyable
,
Movable
Methodsβ
__init__
β
__init__(inout self: Self)
Default constructor for MojoValue.
__init__[T: Movable](inout self: Self, owned val: T)
Creates Type erased Mojo Value from T.
Args:
- βval (
T
): Object to type erase.
__moveinit__
β
__moveinit__(inout self: Self, owned existing: Self)
Move constructor for AnyMojoValue.
Args:
- βexisting (
Self
): Instance to move from.
__del__
β
__del__(owned self: Self)
Destructor for AnyMojoValue.
take
β
take(inout self: Self) -> Self
Returns the current value and initializes this object to default state.
Returns:
An instance of AnyMojoValue.
to
β
to[T: Movable](owned self: Self) -> $0
Consume this object and produces an instance of T. This doesn't do any type check and assumes this AnyMojoValue was created from T.
Returns:
Instance of type T.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?