rocket::mtls::x509::der_parser::asn1_rs

Trait TestValidCharset

Source
pub trait TestValidCharset {
    // Required method
    fn test_valid_charset(i: &[u8]) -> Result<(), Error>;
}
Available on crate feature mtls only.
Expand description

Base trait for BER string objects and character set validation

This trait is implemented by several types, and is used to determine if some bytes would be valid for the given type.

§Example

use asn1_rs::{PrintableString, TestValidCharset, VisibleString};

let bytes: &[u8] = b"abcd*4";
let res = PrintableString::test_valid_charset(bytes);
assert!(res.is_err());
let res = VisibleString::test_valid_charset(bytes);
assert!(res.is_ok());

Required Methods§

Source

fn test_valid_charset(i: &[u8]) -> Result<(), Error>

Check character set for this object type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§