const class_universal
pub const class_universal = 0用途
公开常量 `class_universal`。 值为 `0`
参数
无
API
#encoding/asn1DER TLV 编解码;INTEGER 拟合 i64。
const class_universalpub const class_universal = 0公开常量 `class_universal`。 值为 `0`
无
const class_contextpub const class_context = 2公开常量 `class_context`。 值为 `2`
无
const tag_booleanpub const tag_boolean = 1公开常量 `tag_boolean`。 值为 `1`
无
const tag_integerpub const tag_integer = 2公开常量 `tag_integer`。 值为 `2`
无
const tag_bit_stringpub const tag_bit_string = 3公开常量 `tag_bit_string`。 值为 `3`
无
const tag_octet_stringpub const tag_octet_string = 4公开常量 `tag_octet_string`。 值为 `4`
无
const tag_nullpub const tag_null = 5公开常量 `tag_null`。 值为 `5`
无
const tag_oidpub const tag_oid = 6公开常量 `tag_oid`。 值为 `6`
无
const tag_utf8_stringpub const tag_utf8_string = 12公开常量 `tag_utf8_string`。 值为 `12`
无
const tag_sequencepub const tag_sequence = 16公开常量 `tag_sequence`。 值为 `16`
无
const tag_setpub const tag_set = 17公开常量 `tag_set`。 值为 `17`
无
const tag_printable_stringpub const tag_printable_string = 19公开常量 `tag_printable_string`。 值为 `19`
无
const tag_ia5_stringpub const tag_ia5_string = 22公开常量 `tag_ia5_string`。 值为 `22`
无
const tag_utc_timepub const tag_utc_time = 23公开常量 `tag_utc_time`。 值为 `23`
无
const tag_generalized_timepub const tag_generalized_time = 24公开常量 `tag_generalized_time`。 值为 `24`
无
struct Valuepub struct Value {
pub class int
pub constructed int
pub tag int
pub bytes string
pub rest string
}公开结构体 `Value`。
class intconstructed inttag intbytes stringrest stringstruct Decoderpub struct Decoder {
pub data string
pub pos int
}公开结构体 `Decoder`。
data stringpos intnew_decoderpub fn new_decoder(data &string) Decoder构造 decoder。
data &stringDecoder — 该类型的值
marshal_boolpub fn marshal_bool(v bool) string编码写出bool。
v boolstring — 结果字符串
marshal_nullpub fn marshal_null() string编码写出null。
无
string — 结果字符串
marshal_octetpub fn marshal_octet(s &string) string编码写出octet。
s &stringstring — 结果字符串
marshal_utf8pub fn marshal_utf8(s &string) string编码写出utf8。
s &stringstring — 结果字符串
marshal_bit_stringpub fn marshal_bit_string(s &string) string编码写出bit字符串。
s &stringstring — 结果字符串
marshal_intpub fn marshal_int(n int) string编码写出int。
n intstring — 结果字符串
marshal_oidpub fn marshal_oid(arcs &[]int) string编码写出oid。失败时 throw。
arcs &[]intstring — 结果字符串
marshal_seqpub fn marshal_seq(elems &[]string) string编码写出seq。
elems &[]stringstring — 结果字符串
unmarshalpub fn unmarshal(data &string) Value解码读入。失败时 throw。
data &stringValue — 该类型的值
parse_atpub fn parse_at(data &string, off int) Value解析为 at。失败时 throw。
data &stringoff intValue — 该类型的值
(Decoder) donepub fn (d Decoder) done() bool`Decoder` 上的方法:完成一项。
d Decoderbool — 是否成立
(Value) as_bit_stringpub fn (v Value) as_bit_string() string`Value` 上的方法:asbit字符串。失败时 throw。
v Valuestring — 结果字符串
(&mut Decoder) nextpub fn (d &mut Decoder) next() Value`&mut Decoder` 上的方法:取出下一项;没有则按本类型约定结束。失败时 throw。
d &mut DecoderValue — 该类型的值
(Value) as_boolpub fn (v Value) as_bool() bool`Value` 上的方法:asbool。失败时 throw。
v Valuebool — 是否成立
(Value) as_intpub fn (v Value) as_int() int`Value` 上的方法:asint。失败时 throw。
v Valueint — 该类型的值
(Value) as_octetpub fn (v Value) as_octet() string`Value` 上的方法:asoctet。失败时 throw。
v Valuestring — 结果字符串
(Value) as_utf8pub fn (v Value) as_utf8() string`Value` 上的方法:asutf8。失败时 throw。
v Valuestring — 结果字符串
(Value) as_nullpub fn (v Value) as_null() bool`Value` 上的方法:asnull。失败时 throw。
v Valuebool — 是否成立
(Value) as_oidpub fn (v Value) as_oid() []int`Value` 上的方法:asoid。失败时 throw。
v Value[]int — 切片结果