struct

TLV::Any

Inherits Struct < Value < Object

Constructors

from_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Any

Parse a single TLV element from IO

Source
from_slice(bytes : Bytes) : Any

Parse from bytes

Source
from_tlv(data : Bytes) : Any
Source
new(header : Header, value : Types | Arrays | List | Structure)
Source
new(value : Nil, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any

Create TLV::Any from Crystal values

Source
new(value : Bool, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : Int8, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any

Signed integers - use minimum-size encoding

Source
new(value : UInt8, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any

Unsigned integers - use minimum-size encoding

Source
new(value : Float32, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : Float64, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : String, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : Bytes, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : Structure, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil) : Any
Source
new(value : Int16, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : Int32, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : Int64, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : UInt16, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : UInt32, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : UInt64, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, fixed_size : Bool = false) : Any
Source
new(value : List, tag : Nil | UInt8 | Tuple(UInt16, UInt16) | Tuple(UInt16, UInt16, UInt16) = nil, *, as_array : Bool = false) : Any
Source

Instance methods

[](index : Int32) : Any

Access list/array elements by index

Source
[](tag : TagId) : Any

Access structure elements by tag

Source
[]?(index : Int32) : Any | Nil
Source
[]?(tag : TagId) : Any | Nil
Source
as_bool
Source
as_bool?
Source
as_bytes
Source
as_bytes?
Source
as_f32
Source
as_f32?
Source
as_f64
Source
as_f64?
Source
as_i16
Source
as_i16?
Source
as_i32
Source
as_i32?
Source
as_i64
Source
as_i64?
Source
as_i8
Source
as_i8?

Get the raw value cast to specific types (with widening support)

Source
as_list
Source
as_list?
Source
as_nil
Source
as_nil?
Source
as_s
Source
as_s?
Source
as_structure
Source
as_structure?
Source
as_u16
Source
as_u16?
Source
as_u32
Source
as_u32?
Source
as_u64
Source
as_u64?
Source
as_u8
Source
as_u8?
Source
container?

Check if this is a container

Source
each

Iterate over list/array entries

Source
each_pair

Iterate over structure entries (tag, value pairs)

Source
header
Source
size

Get size of container

Source
to_io(io : IO, format : IO::ByteFormat = IO::ByteFormat::LittleEndian) : Nil

Write TLV element to IO

Source
to_slice

Serialize to bytes

Source
to_tlv
Source
value
Source