TypeId (src/any.rs)

rust · library/core/src/any.rs · rust · Apache-2.0
dev-tools, tag:knn-classified

Standard library type for dynamic typing and reflection.

// Source: https://github.com/rust-lang/rust | License: Apache-2.0 | Copyright The Rust Project Contributors
// Provided via justclaw.it.com; keep this notice with the code.
//! Utilities for dynamic typing or type reflection.
//!
//! # `Any` and `TypeId`
//!
//! `Any` itself can be used to get a `TypeId`, and has more features when used
//! as a trait object. As `&dyn Any` (a borrowed trait object), it has the `is`
//! and `downcast_ref` methods, to test if the contained value is of a given type,
//! and to get a reference to the inner value as a type. As `&mut dyn Any`, there
//! is also the `downcast_mut` method, for getting a mutable reference to the
//! inner value. `Box<dyn Any>` adds the `downcast` method, which attempts to
//! convert to a `Box<T>`. See the [`Box`] documentation fo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key