TagLike

Trait TagLike 

Source
pub trait TagLike:
    Copy
    + PartialEq
    + Sized {
    // Required method
    fn embedding(self) -> Tag;

    // Provided methods
    fn assert_eq(self, expected: Self) -> Result<Self> { ... }
    fn with_value<V>(self, value: V) -> TaggedValue<V, Self> { ... }
}
Expand description

This is the common trait that types to be used as tags are supposed to implement.

Required Methods§

Source

fn embedding(self) -> Tag

To stick with one Error type, make sure the tag type can somehow or other be coerced into a BerTag.

Provided Methods§

Source

fn assert_eq(self, expected: Self) -> Result<Self>

Assert that this Tag matches the provided expected tag.

On mismatch, returns an Error with ErrorKind::UnexpectedTag.

Source

fn with_value<V>(self, value: V) -> TaggedValue<V, Self>

Ergonomic way to get a TaggedValue for a given tag and value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§