Struct eagre_asn1::types::Any [] [src]

pub struct Any {
    // some fields omitted
}
[]

Asn1 Any Type

Any encoded "Any" type will not be visible in the encoded bytes. It is a helper type, which should be used in case the actual type is not known yet.

Example

let any = Any::new("I am a random string".to_string()).unwrap();
let encoded = any.der_bytes().unwrap();
// Send to far away planet
let decoded = Any::der_from_bytes(encoded).unwrap();
assert_eq!("I am a random string", &decoded.resolve::<String>().unwrap());

Methods

impl Any
[src]

fn new<T: DER>(val: T) -> Result<Any>[]

Create a new Any object from a inner value

fn resolve<T: DER>(&self) -> Result<T>[]

Resolve the inner value of an Any object

Trait Implementations

impl DER for Any
[src]

fn der_universal_tag() -> UniversalTag[]

Return universal tag of this type

fn der_content() -> ContentType[]

Return content type of this type

fn der_encode_content(&self, _: &mut Write) -> Result<()>[]

Encode the content octets

fn der_decode_content(_: &mut Read, _: usize) -> Result<Self>[]

Decode the content octets

fn der_intermediate(&self) -> Result<Intermediate>[]

Create Intermediate from this object

fn der_from_intermediate(i: Intermediate) -> Result<Self>[]

Create object from Intermediate

fn der_encode(&self, w: &mut Write) -> Result<()>[]

Fully encode into stream ( tag bytes + length bytes + content bytes )

fn der_bytes(&self) -> Result<Vec<u8>>[]

Return fully encoded bytes (wrapper for der_encode() for easier use)

fn der_decode(r: &mut Read) -> Result<Self>[]

Create object from stream

fn der_from_bytes(bytes: Vec<u8>) -> Result<Self>[]

Create object from bytes

Derived Implementations

impl Debug for Any
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result[]

Formats the value using the given formatter.