Trait Branded

Source
pub trait Branded {
    type Inner;

    // Required methods
    fn inner(&self) -> &Self::Inner;
    fn into_inner(self) -> Self::Inner;
}
Expand description

A trait for types that are a brand of some inner type.

This trait is not used for specific features internally, but you may use it if you want to write generic code over all branded types.

Required Associated Types§

Source

type Inner

The inner type of the brand.

This type is usually best represented as an ID such as string, an integer, or a UUID, but any type is allowed.

Required Methods§

Source

fn inner(&self) -> &Self::Inner

Get a reference to the inner type.

Source

fn into_inner(self) -> Self::Inner

Convert the branded type to the inner type.

Implementors§