Skip to content

Repository files navigation

zig-syrup

This is a Zig Syrup implementation.

This library hasn't been checked for security issues. Use at your own risk.

See The Syrup Specification for details.

Documentation

Documentation is available using the standard Zig documentation browser.

Implemented data types

Reader

  • Booleans
  • Floats
  • Doubles
  • Positive integers
  • Negative integers
  • Binary data
  • Strings
  • Symbols
  • Dictionaries
  • Sequences
  • Records
  • Sets

Writer

  • Booleans
  • Floats
  • Doubles
  • Positive integers
  • Negative integers
  • Binary data
  • Strings
  • Symbols
  • Dictionaries
  • Sequences
  • Records
  • Sets

Zig types

Zig Types that can be (de)serialized to Syrup

Writer

  • integers (any length)
  • f32
  • f64
  • comptime integers
  • comptime float (as f64)
  • optionals
  • enum literals
  • arrays
  • slices
  • vectors
  • []const u8
  • HashMap - need tests
  • Set - need tests
  • structs
    • as Record (label is the type name)
    • as Sequence (just the field values)
    • as Dictionary (key is the field name)
  • unions
  • tuples
  • general pointers
  • dynamic.Value

Reader

  • integers (any length)
  • f32
  • f64
  • optionals
  • enum literals
  • arrays
  • slices
  • vectors
  • []const u8
  • HashMap
  • Set
  • structs
    • from Record (label is the type name)
    • from Sequence (just the field values)
    • from Dictionary (key is the field name)
  • unions
  • tuples
  • general pointers
  • dynamic.Value

Benchmark

There is a benchmarking tool available at zig-syrup-benchmark. This also serves an example of how to add the Syrup library to a project.

TODO

  • ZON to syrup conversion - Zig's ZON format could possibly be converted to Syrup, if we so pleased.
  • Serializing Zig structures - Use comptime to convert Zig structs, slices, etc to Syrup format
  • Benchmarking - zig-syrup-benchmark
    • Could do more.
  • Fuzz testing - Zig has fuzz testing support in the standard library we could play with.
  • jsyrup support - human readable syrup format
    • Indented jsyrup
  • syrupify - Add support for user function to transform zig struct
  • libsyrup - a C API for the low level syrup serialization
  • CLI tool - to quickly pretty-print syrup structure and convert to jsyrup, unsure if converting ZON to syrup is useful here without type information, maybe it's possible/useful.

About

Read-only mirror of zig-syrup, an ocapn serialization library. This library is NOT AI slop, unlike those other ones.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages