OxL Справочник OxL
РусскийEnglish

interface Serializable

Types that std.ser can encode and decode, and that can cross the network (@derive(Serializable), implicit for plain data).

Example:

oxl✓ проверяется в CI
use std.ser { encode, decode }

data Point { x: i32; y: i32 }

fn main() io {
  let bytes = encode(&Point{ x: 3, y: 4 })!
  let p = decode<Point>(&bytes)!
  print("{p.x} {p.y}")
}
Вывод
3 4
@explicit pub(api) interface Serializable

С версии. 1.0.0-beta

Определено в: std/core/types.oxl:1038

См. также