registration

Macro registration 

Source
macro_rules! registration {
    ($registry_type:ty, $registered_type:ty) => { ... };
}
Expand description

Should be used to implement Registered::register.

For example:

use type_registry::{registration, Registered, Registration, Registry};
 
struct MyRegistry;

impl Registry for MyRegistry {
    type TypeInfo = ();
 
    fn name() -> &'static str {
        "My Registry"
    }
}

struct MyType;

unsafe impl Registered<MyRegistry> for MyType {
    fn register() -> Registration<MyRegistry, Self> {
        registration!(MyRegistry, MyType)
    }

    fn type_info() -> &'static <MyRegistry as Registry>::TypeInfo {
        todo!()
    }
}