Something went wrong. Try again.
A CBOR serialization library implementing the DRISL application profile
serialization atproto dasl drisl cid swift cbor
Something went wrong. Try again.
Files
README.md
DRISL #
A CBOR serialization library implementing the DRISL application profile.
Note
This is a work in progress, feedback welcome.
Overview #
import DRISL
@Deserializable
@Serializable
struct Foo {
var a: Int
var b: Int?
@Optional var c: Int?
@Optional var d: Int??
}
let deserializer = Deserializer()
let foo = try deserializer.deserialize(
Foo.self,
from: ([163, 97, 97, 7, 97, 98, 246, 97, 100, 23] as [UInt8]).span.bytes
)
print(foo) // Foo(a: 7, b: nil, c: nil, d: Optional(Optional(23)))
let serializer = Serializer()
let serialized = try serializer.serialize(foo)
print(unsafe serialized.bytes.withUnsafeBytes([UInt8].init(_:))) // [163, 97, 97, 7, 97, 98, 246, 97, 100, 23]
Installation #
dependencies: [
.package(url: "https://tangled.org/lksz.name/swift-drisl-cbor", branch: "main"),
]