pub enum BerValue {
Boolean(bool),
Integer(i64),
Real(f64),
String(String),
OctetString(Vec<u8>),
Null,
Sequence(Vec<BerValue>),
Context {
tag: u32,
value: Box<BerValue>,
},
Application {
tag: u32,
value: Box<BerValue>,
},
Raw {
tag: Tag,
data: Vec<u8>,
},
}Expand description
A generic BER value that can hold any type.
Variants§
Boolean(bool)
Boolean value
Integer(i64)
Integer value
Real(f64)
Real (floating point) value
String(String)
UTF-8 string value
OctetString(Vec<u8>)
Octet string (raw bytes) value
Null
Null value
Sequence(Vec<BerValue>)
Sequence of values
Context
Context-tagged value
Application
Application-tagged value
Raw
Raw TLV (for unknown or unprocessed data)
Implementations§
Source§impl BerValue
impl BerValue
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Try to get this value as a boolean.
Sourcepub fn as_integer(&self) -> Option<i64>
pub fn as_integer(&self) -> Option<i64>
Try to get this value as an integer.
Sourcepub fn as_octet_string(&self) -> Option<&[u8]>
pub fn as_octet_string(&self) -> Option<&[u8]>
Try to get this value as an octet string.
Sourcepub fn as_sequence(&self) -> Option<&[BerValue]>
pub fn as_sequence(&self) -> Option<&[BerValue]>
Try to get this value as a sequence.
Sourcepub fn decode_from_reader(reader: &mut BerReader<'_>) -> Result<Self>
pub fn decode_from_reader(reader: &mut BerReader<'_>) -> Result<Self>
Decode a BER value from a reader.
Sourcepub fn encode_to_writer(&self, writer: &mut BerWriter) -> Result<()>
pub fn encode_to_writer(&self, writer: &mut BerWriter) -> Result<()>
Encode this value to a writer.
Trait Implementations§
impl StructuralPartialEq for BerValue
Auto Trait Implementations§
impl Freeze for BerValue
impl RefUnwindSafe for BerValue
impl Send for BerValue
impl Sync for BerValue
impl Unpin for BerValue
impl UnsafeUnpin for BerValue
impl UnwindSafe for BerValue
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