pub struct BmpString(pub String);Expand description
ASN.1 BMPString (tag 30)
Characters encoded as UCS-2 big-endian (Basic Multilingual Plane only, 2 bytes per code point). Decoded to a Rust String on construction.
Tuple Fields§
§0: StringImplementations§
Source§impl BmpString
impl BmpString
Sourcepub fn new(s: String) -> Result<Self>
pub fn new(s: String) -> Result<Self>
Create a new BmpString from a Rust string.
Returns an error if the string contains code points outside the BMP (> U+FFFF).
Sourcepub fn from_ucs2_be(bytes: &[u8]) -> Result<Self>
pub fn from_ucs2_be(bytes: &[u8]) -> Result<Self>
Decode a BMPString from raw UCS-2 big-endian bytes.
Returns an error if the byte length is not even, or if any two-byte sequence is a surrogate half (which would be invalid UCS-2).
Sourcepub fn to_ucs2_be(&self) -> Vec<u8> ⓘ
pub fn to_ucs2_be(&self) -> Vec<u8> ⓘ
Encode the string as UCS-2 big-endian bytes.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert into the inner String.
Trait Implementations§
impl Eq for BmpString
impl StructuralPartialEq for BmpString
Auto Trait Implementations§
impl Freeze for BmpString
impl RefUnwindSafe for BmpString
impl Send for BmpString
impl Sync for BmpString
impl Unpin for BmpString
impl UnsafeUnpin for BmpString
impl UnwindSafe for BmpString
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> TagForOptional for Twhere
T: Tagged,
impl<T> TagForOptional for Twhere
T: Tagged,
Source§fn optional_tag() -> Option<Tag>
fn optional_tag() -> Option<Tag>
Return the expected tag for optional-field peek-ahead, or
None if
the type accepts multiple tags (CHOICE) or any tag (ANY / Element<'a>).