asn1rs
asn1rs copied to clipboard
Solve character string types in a nicer way
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.