Trait rasn::Encode

source ·
pub trait Encode: AsnType {
    // Required method
    fn encode_with_tag_and_constraints<E: Encoder>(
        &self,
        encoder: &mut E,
        tag: Tag,
        constraints: Constraints<'_>
    ) -> Result<(), E::Error>;

    // Provided methods
    fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> { ... }
    fn encode_with_tag<E: Encoder>(
        &self,
        encoder: &mut E,
        tag: Tag
    ) -> Result<(), E::Error> { ... }
    fn encode_with_constraints<E: Encoder>(
        &self,
        encoder: &mut E,
        constraints: Constraints<'_>
    ) -> Result<(), E::Error> { ... }
}
Expand description

A data type that can be encoded to a ASN.1 data format.

Required Methods§

source

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

Provided Methods§

source

fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error>

Encodes self’s data into the given Encoder.

Note for implementors You typically do not need to implement this. The default implementation will call Encode::encode_with_tag with your types associated AsnType::TAG. You should only ever need to implement this if you have a type that cannot be implicitly tagged, such as a CHOICE type, in which case you want to implement encoding in encode.

source

fn encode_with_tag<E: Encoder>( &self, encoder: &mut E, tag: Tag ) -> Result<(), E::Error>

Encode this value with tag into the given Encoder.

Note For CHOICE and other types that cannot be implicitly tagged this will explicitly tag the value, for all other types, it will implicitly tag the value.

source

fn encode_with_constraints<E: Encoder>( &self, encoder: &mut E, constraints: Constraints<'_> ) -> Result<(), E::Error>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Encode for &str

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for bool

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, _: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for i8

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for i16

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for i32

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for i64

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for isize

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for u8

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for u16

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for u32

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for u64

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for ()

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, _: Constraints<'_> ) -> Result<(), E::Error>

source§

impl Encode for usize

source§

fn encode_with_tag_and_constraints<E: Encoder>( &self, encoder: &mut E, tag: Tag, constraints: Constraints<'_> ) -> Result<(), E::Error>

source§

impl<E: Encode> Encode for Option<E>

source§

fn encode<EN: Encoder>(&self, encoder: &mut EN) -> Result<(), EN::Error>

source§

fn encode_with_tag<EN: Encoder>( &self, encoder: &mut EN, tag: Tag ) -> Result<(), EN::Error>

source§

fn encode_with_constraints<EN: Encoder>( &self, encoder: &mut EN, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

impl<E: Encode> Encode for &E

source§

fn encode<EN: Encoder>(&self, encoder: &mut EN) -> Result<(), EN::Error>

source§

fn encode_with_tag<EN: Encoder>( &self, encoder: &mut EN, tag: Tag ) -> Result<(), EN::Error>

source§

fn encode_with_constraints<EN: Encoder>( &self, encoder: &mut EN, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

impl<E: Encode> Encode for Box<E>

source§

fn encode<EN: Encoder>(&self, encoder: &mut EN) -> Result<(), EN::Error>

source§

fn encode_with_tag<EN: Encoder>( &self, encoder: &mut EN, tag: Tag ) -> Result<(), EN::Error>

source§

fn encode_with_constraints<EN: Encoder>( &self, encoder: &mut EN, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

impl<E: Encode> Encode for BTreeSet<E>

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

impl<E: Encode> Encode for Vec<E>

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

source§

impl<E: Encode, const N: usize> Encode for [E; N]

source§

fn encode_with_tag_and_constraints<EN: Encoder>( &self, encoder: &mut EN, tag: Tag, constraints: Constraints<'_> ) -> Result<(), EN::Error>

Implementors§