// Copyright 2023 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 type_name(&self) -> &'static str {
std::any::type_name::<Self>()
}
fn as_any(&self) -> &dyn Any;
}
impl<T: Any> AsAny for T {
fn as_any(&self) -> &dyn Any {
self
}
}