Mojo function
trait_downcast_var
trait_downcast_var[T: Movable, //, Trait: AnyTrait[Movable]](var src: T) -> T(Trait)
Downcast a parameter input type T and rebind the type such that the return value's type conforms to the provided Trait. If T, after resolving to a concrete type, does not actually conform to Trait, a compilation error will occur.
Parameters:
- โT (
Movable): The original type (inferred). - โTrait (
AnyTrait): The trait to downcast into.
Args:
- โsrc (
T): The value to downcast.
Returns:
T(Trait): The downcasted value.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!