Programming Language

Nocter

A self-contained systems language built around simplicity, encapsulation, and foolproof design.

index.nct

#package: {
    name: "binary-record",
    version: "0.1.0",
}

#executable: {
    name: "binary-record",
}

#test: {
    name: "unit",
    module: ".",
}

use std/io.{BlockingReader, Reader}

see ./application.nct

see ./parsing.nct

see ./streams.nct

see ./tests.nct

see ./wire.nct

pub copy struct Record

construct Record {
    pub noalloc func new(item_count: u32, measurement: f64): Self
}

instance Record {
    pub noalloc method &self.item_count(): u32

    pub noalloc method &self.measurement(): f64
}

pub enum RecordTail {
    complete
    incomplete
    invalid_magic
    unsupported_version
    non_canonical_length
    length_overflow
    excessive_length
    unexpected_length
    checksum_mismatch
}

pub struct RecordLog

instance RecordLog {
    pub noalloc method &self.len(): usize

    pub noalloc method &self.record(index: usize): Record?

    pub noalloc method &self.tail(): RecordTail
}

pub struct FragmentedBytes

construct FragmentedBytes {
    pub noalloc func new(input: &[u8], maximum_chunk: usize): Self from input
}

instance FragmentedBytes {
    impl BlockingReader
    impl Reader
}

pub func encode_log(records: &[Record]): Vec<u8>!

pub func decode_log(input: &[u8]): RecordLog!

pub blocking func decode_blocking<R>(reader: &+R): RecordLog! where R impl BlockingReader

pub async func decode_async<R>(reader: &+R): RecordLog! where R impl Reader

pub async func main(): i32!