Add code comments.
This commit is contained in:
10
src/any.rs
10
src/any.rs
@@ -1,7 +1,7 @@
|
||||
//! Helper module which defines the `Any` trait to to allow dynamic value handling.
|
||||
|
||||
use crate::stdlib::{
|
||||
any::{self, type_name, TypeId},
|
||||
any::{type_name, Any as StdAny, TypeId},
|
||||
boxed::Box,
|
||||
fmt,
|
||||
};
|
||||
@@ -13,7 +13,7 @@ pub type Variant = dyn Any;
|
||||
pub type Dynamic = Box<Variant>;
|
||||
|
||||
/// A trait covering any type.
|
||||
pub trait Any: any::Any {
|
||||
pub trait Any: StdAny {
|
||||
/// Get the `TypeId` of this type.
|
||||
fn type_id(&self) -> TypeId;
|
||||
|
||||
@@ -23,12 +23,12 @@ pub trait Any: any::Any {
|
||||
/// Convert into `Dynamic`.
|
||||
fn into_dynamic(&self) -> Dynamic;
|
||||
|
||||
/// This type may only be implemented by `rhai`.
|
||||
/// This trait may only be implemented by `rhai`.
|
||||
#[doc(hidden)]
|
||||
fn _closed(&self) -> _Private;
|
||||
}
|
||||
|
||||
impl<T: Clone + any::Any + ?Sized> Any for T {
|
||||
impl<T: Clone + StdAny + ?Sized> Any for T {
|
||||
fn type_id(&self) -> TypeId {
|
||||
TypeId::of::<T>()
|
||||
}
|
||||
@@ -91,7 +91,7 @@ pub trait AnyExt: Sized {
|
||||
/// Get a copy of a `Dynamic` value as a specific type.
|
||||
fn downcast<T: Any + Clone>(self) -> Result<Box<T>, Self>;
|
||||
|
||||
/// This type may only be implemented by `rhai`.
|
||||
/// This trait may only be implemented by `rhai`.
|
||||
#[doc(hidden)]
|
||||
fn _closed(&self) -> _Private;
|
||||
}
|
||||
|
Reference in New Issue
Block a user