OxL Reference

fn decode

Decodes b into a T; errors per [С §9.4].

Example:

oxl✓ checked in CI
use std.ser { encode, decode }

fn main() io {
  let b = encode(&"hi")!
  let s: str = decode(&b)!
  print(s)
}
Output
hi
@intrinsic("ser.decode") pub(api) fn decode<T: Serializable>(b: &bytes, fmt: Format = Format.Oxl) -> T | DecodeError

Since. 1.0.0-beta

Parameters

NameType
b&bytes
fmtFormat = Format.Oxl

Returns

T

Errors

Effects

none declared (pure unless the body says otherwise)

Defined in: std/ser/ser.oxl:2306

See also