New Procedural Macros Crate v0.1
This commit is contained in:
@@ -681,6 +681,13 @@ impl Dynamic {
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy and return a `Dynamic` if it contains a type that can be trivially copied.
|
||||
/// Returns `None` if the cast fails.
|
||||
#[inline(always)]
|
||||
pub fn downcast_clone<T: Variant + Clone>(&self) -> Option<T> {
|
||||
self.downcast_ref::<T>().map(|t| t.clone())
|
||||
}
|
||||
|
||||
/// Cast the `Dynamic` as the system integer type `INT` and return it.
|
||||
/// Returns the name of the actual type if the cast fails.
|
||||
pub fn as_int(&self) -> Result<INT, &'static str> {
|
||||
|
Reference in New Issue
Block a user