Mojo module
rebind
Implements type rebind/trait downcast
These are Mojo built-ins, so you don't need to import them.
Aliases
downcast
alias downcast[_Trait: AnyTrait[AnyType], T: AnyType] = downcast(:trait<@stdlib::@builtin::@anytype::@AnyType> T)
Parameters
- _Trait (
AnyTrait): - T (
AnyType):
Functions
-
rebind: Statically assert that a parameter input typesrc_typeresolves to the same type as a parameter result typedest_typeafter function instantiation and "rebind" the input to the result type. -
rebind_var: Statically assert that a parameter input typesrc_typeresolves to the same type as a parameter result typedest_typeafter function instantiation and "rebind" the input to the result type, returning a owned variable with an adjusted type. -
trait_downcast: Downcast a parameter input typeTand rebind the type such that the return value's type conforms the providedTrait. IfT, after resolving to a concrete type, does not actually conform toTrait, a compilation error would occur.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!