// moon.pkg
import "Milky2018/zstd" @zstdlet input = b"hello zstd"
let compressed = @zstd.compress(input)
let restored = @zstd.decompress(compressed)
assert_eq(restored, input)pub suberror ZstdError {
SrcSizeTooLarge(UInt64)
SrcSizeWrong
CorruptionDetected
BoundOverflow
DictionaryRequired(UInt)
UnsupportedFeature(String)
}pub struct CompressOptions {
level : Int
checksum : Bool
single_segment : Bool
write_content_size : Bool
compact_frame_header : Bool
window_log : Int
enable_long_distance_matching : Bool
target_compressed_block_size : Int
}fn CompressOptions::with_compact_frame_header(self : CompressOptions, enabled : Bool) -> CompressOptionsfn CompressOptions::with_long_distance_matching(self : CompressOptions, enabled : Bool) -> CompressOptionsfn CompressOptions::with_target_compressed_block_size(self : CompressOptions, size : Int) -> CompressOptionsfn compress_bound_macro(src_size : UInt64) -> UInt64fn compress_with_dictionary(src : Bytes, dictionary : Bytes, level? : Int, checksum? : Bool) -> Bytes raise ZstdErrorfn compress_with_dictionary_and_options(src : Bytes, dictionary : Bytes, options : CompressOptions) -> Bytes raise ZstdErrorfn new_compressor_with_dictionary_and_options(dictionary : Bytes, options : CompressOptions) -> Compressor