///|
/// Decode a raw byte stream into a BER value tree and print it. Demonstrates
/// that the BER decoder is a reusable, general-purpose ASN.1 component.
fn main {
// A SEQUENCE containing INTEGER 42, OCTET STRING "a" and NULL.
let bytes = Bytes::from_array([
0x30, 0x08, 0x02, 0x01, 0x2A, 0x04, 0x01, 0x61, 0x05, 0x00,
])
let value = @moonldap.decode_ber(bytes, None).unwrap()
println(value.to_string())
println("---")
// An LDAP bind message decoded as a generic BER tree.
let bind = Bytes::from_array([
0x30, 0x10, 0x02, 0x01, 0x01, 0x60, 0x0B, 0x02, 0x01, 0x03, 0x04, 0x02, 0x63,
0x6E, 0x80, 0x02, 0x70, 0x77,
])
let msg = @moonldap.decode_ber(bind, None).unwrap()
println(msg.to_string())
}