asn1rs icon indicating copy to clipboard operation
asn1rs copied to clipboard

Solve character string types in a nicer way

Open kellerkindt opened this issue 3 years ago • 0 comments

Currently each character string type has its own read_*/write_* fn which every Reader/Writer must implement


    fn read_utf8string<C: utf8string::Constraint>(&mut self) -> Result<String, Self::Error>;

    fn read_ia5string<C: ia5string::Constraint>(&mut self) -> Result<String, Self::Error>;

    fn read_numeric_string<C: numericstring::Constraint>(&mut self) -> Result<String, Self::Error>;

    fn read_visible_string<C: visiblestring::Constraint>(&mut self) -> Result<String, Self::Error>;

    fn read_printable_string<C: printablestring::Constraint>(
        &mut self,
    ) -> Result<String, Self::Error>;

Consider a common fn (like read_characters?) and pass the Charset as (type) parameter? Same with the Utf8String, Ia5String, ... types.

kellerkindt avatar Mar 11 '21 12:03 kellerkindt