asn1_rs/to_ber/
primitive.rs

1use std::io;
2use std::io::Write;
3
4use crate::{Class, Tag};
5
6use super::BerEncoder;
7
8#[allow(missing_debug_implementations)]
9pub struct Primitive<const TAG: u32> {}
10
11impl<const TAG: u32> Primitive<TAG> {
12    pub const fn new() -> Self {
13        Self {}
14    }
15}
16
17impl<const TAG: u32> Default for Primitive<TAG> {
18    fn default() -> Self {
19        Self::new()
20    }
21}
22
23impl<const TAG: u32> BerEncoder for Primitive<TAG> {
24    fn new() -> Self {
25        Primitive::new()
26    }
27
28    fn write_tag_info<W: Write>(
29        &mut self,
30        _class: Class,
31        _constructed: bool,
32        _tag: Tag,
33        target: &mut W,
34    ) -> Result<usize, io::Error> {
35        self.write_tag_generic(Class::Universal, false, Tag(TAG), target)
36    }
37}