Trait TryIntoTag

Source
pub trait TryIntoTag<R, Discriminant: DiscriminantTag = ()> {
    type Error;

    // Required method
    fn try_into_tag(self) -> Result<R, Self::Error>;
}
Expand description

Fallible version of IntoTag.

Attempts to convert self into another representation under a given discriminant, returning an error if the conversion fails.

§Type Parameters

  • R: Target type (may be generic or non-concrete).
  • Discriminant: A concrete marker type used to disambiguate conversions.

§Default Discriminant

  • Discriminant = (): uses the unit type as a default tag, meaning no additional disambiguation when a single interpretation exists.

Required Associated Types§

Required Methods§

Source

fn try_into_tag(self) -> Result<R, Self::Error>

Implementations on Foreign Types§

Source§

impl TryIntoTag<(), NoneTag> for ()

Trivial extraction of None from unit.

Source§

impl TryIntoTag<(), SomeTag> for ()

Trivial extraction of Some from unit.

Source§

impl TryIntoTag<[(); 0], ManyTag> for ()

Trivial extraction of Many as a zero-sized array from unit.

Implementors§

Source§

impl<Type, S> TryIntoTag<(), NoneTag> for SumDynType<Type, S>
where Type: Delimited, S: Get<u32> + Clone + Debug + 'static,

Source§

impl<Type, S> TryIntoTag<Type, SomeTag> for SumDynType<Type, S>
where Type: Delimited, S: Get<u32> + Clone + Debug + 'static,

Source§

impl<Type, const N: usize> TryIntoTag<[Type; N], ManyTag> for SumStaticType<Type, N>
where Type: Delimited,

Source§

impl<Type, const N: usize> TryIntoTag<(), NoneTag> for SumStaticType<Type, N>
where Type: Delimited,

Source§

impl<Type, const N: usize> TryIntoTag<Type, SomeTag> for SumStaticType<Type, N>
where Type: Delimited,