Skip to main content

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 type src_type resolves to the same type as a parameter result type dest_type after function instantiation and "rebind" the input to the result type.
  • rebind_var: Statically assert that a parameter input type src_type resolves to the same type as a parameter result type dest_type after function instantiation and "rebind" the input to the result type, returning a owned variable with an adjusted type.
  • trait_downcast: Downcast a parameter input type T and rebind the type such that the return value's type conforms the provided Trait. If T, after resolving to a concrete type, does not actually conform to Trait, a compilation error would occur.

Was this page helpful?