Skip to main content

Module cast

Module cast 

Source
Expand description

Casting objects to trait pointers.

Rust supports Any-to-Concrete downcasting via Any; and the downcast_rs crate supports Trait-to-Concrete downcasting. This module adds Trait-to-Trait downcasting for the Object trait.

Re-exportsΒ§

use std::any::Any; πŸ”’
use std::any::TypeId; πŸ”’
use std::collections::HashMap; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::LazyLock; πŸ”’
use crate::Object; πŸ”’

StructsΒ§

CastTable
A collection of functions to downcast &dyn Object references for some particular concrete object type O into various &dyn Trait references.
Caster πŸ”’
A single entry in a CastTable.

StaticsΒ§

EMPTY_CAST_TABLE πŸ”’
Static cast table that doesn’t support casting anything to anything.