silk/toml_codec
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.
Static contracts for converting common Silk values to and from TOML values.
When to use
Use TomlCodec.writeOne to write a typed value after a key and separator. Use
TomlCodec.decodeOne on a parsed value for allocation-free types, or
TomlCodec.deserializeOne for an owned string.
Import as TomlCodec with import silk.toml_codec { TomlCodec }.
Public declarations: 4.
Serialize
pub interface SerializeA type that writes one TOML value through the ambient Writer.
Operation serialize
effect<'life0> fn serialize<'life0>(self: &'life0 Self) -> () ! TomlError | WriterError ? &mut WriterWrites one value in TOML syntax through the ambient Writer.
Decode
pub interface DecodeA type decoded from an owned TOML value without allocation.
Operation decode
fn decode<'life0>(value: &'life0 silk/toml_value.Value) -> silk/result.Result<Self, silk/toml_scanner.TomlError>Converts one owned TOML value without allocation or returns a typed failure.
Deserialize
pub interface DeserializeA type decoded from an owned TOML value with allocation.
Operation deserialize
effect<'life0> fn deserialize<'life0>(value: &'life0 silk/toml_value.Value) -> Self ! TomlError | OutOfMemoryError ? &mut AllocatorConverts one owned TOML value with the ambient allocator.
TomlCodec
pub struct TomlCodecSelects static TOML conversion witnesses.
Associated function TomlCodec.writeOne
pub effect<'life1> fn writeOne<T: 'life1, 'life1>(value: &'life1 T) -> () ! TomlError | WriterError ? &mut WriterWrites a typed value in value position through the ambient Writer.
Gotchas
Write the key and = before this call when writing a document.
Associated function TomlCodec.decodeOne
pub fn decodeOne<T, 'life1>(value: &'life1 silk/toml_value.Value) -> silk/result.Result<T, silk/toml_scanner.TomlError>Decodes an allocation-free type from one owned value, or returns a typed failure.
Associated function TomlCodec.deserializeOne
pub effect<'life1> fn deserializeOne<T, 'life1>(value: &'life1 silk/toml_value.Value) -> T ! TomlError | OutOfMemoryError ? &mut AllocatorDeserializes an allocating type from one owned value with the ambient allocator.
Implementation Serialize for bool
impl Serialize for boolOperation serialize
serialize = bool.impl@1.serializeImplementation Decode for bool
impl Decode for boolOperation decode
decode = bool.impl@2.decodeImplementation Serialize for i64
impl Serialize for i64Operation serialize
serialize = i64.impl@3.serializeImplementation Decode for i64
impl Decode for i64Operation decode
decode = i64.impl@4.decodeImplementation Serialize for i32
impl Serialize for i32Operation serialize
serialize = i32.impl@5.serializeImplementation Decode for i32
impl Decode for i32Operation decode
decode = i32.impl@6.decodeImplementation Serialize for f64
impl Serialize for f64Operation serialize
serialize = f64.impl@7.serializeImplementation Deserialize for f64
impl Deserialize for f64Operation deserialize
deserialize = f64.impl@8.deserializeImplementation Serialize for string<'a>
impl Serialize for string<'a>Operation serialize
serialize = string.impl@9.serializeImplementation Serialize for String
impl Serialize for StringOperation serialize
serialize = String.impl@10.serializeImplementation Deserialize for String
impl Deserialize for StringOperation deserialize
deserialize = String.impl@11.deserialize