v2 / vlib / x / encoding / asn1 / any.v
27 lines · 23 sloc · 689 bytes · 897ec51480ee51714f03534117f603eb28dae7fa
Raw
1// Copyright (c) 2022, 2024 blackshirt. All rights reserved.
2// Use of this source code is governed by a MIT License
3// that can be found in the LICENSE file.
4module asn1
5
6// ANY DEFINED BY
7//
8pub struct AnyDefinedBy {
9pub:
10 // default to null element
11 params Element = Null{}
12}
13
14// AnyDefinedBy.new creates a new ANY DEFINED BY element.
15pub fn AnyDefinedBy.new(params Element) AnyDefinedBy {
16 return AnyDefinedBy{params}
17}
18
19// tag returns the underlying tag of ANY DEFINED BY element.
20pub fn (a AnyDefinedBy) tag() Tag {
21 return a.params.tag()
22}
23
24// payload returns the underlying payload of ANY DEFINED BY element.
25pub fn (a AnyDefinedBy) payload() ![]u8 {
26 return a.params.payload()!
27}
28