| // Copyright 2021 The Fuchsia Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style license that can be | |
| // found in the LICENSE file. | |
| use std::any::Any; | |
| /// The `AsAny` trait enables callers to downcast a Trait into a concrete implementation, assuming | |
| /// the trait is `+ AsAny`. | |
| pub trait AsAny { | |
| fn as_any(&self) -> &dyn Any; | |
| } | |
| impl<T: Any> AsAny for T { | |
| fn as_any(&self) -> &dyn Any { | |
| self | |
| } | |
| } |