type-registry 0.2.0

Static type registration
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::any::Any;
use crate::logical::registration::Registration;
use crate::logical::registry::Registry;

/// Trait which marks a type as registered with a particular [registry](Registry).
pub unsafe trait Registered<R: Registry + ?Sized>: Any {
    /// Register the type with the [registry](Registry). Should internally use the
    /// [registration! macro (click for example)](crate::registration).
    fn register() -> Registration<R, Self>;

    /// Statically allocate and return the [information](crate::logical::TypeInfo) about the registered type.
    fn type_info() -> &'static <R as Registry>::TypeInfo;
}