netencode/lib-rust/workspace-template
- Cargo.toml 393 B 1 year ago
- README.md 1.1 KiB 1 year ago
Netencode Rust Playground
Welcome to your netencode experimentation workspace! 🦀
Getting Started
Run the examples:
cargo run --example basic # Basic type examples
cargo run --example advanced # Complex structures
cargo run --example playground # Your experiments
Run tests:
cargo test
API Quick Reference
Basic Types
T::unit()- Unit valueT::natural(n)- Unsigned 64-bit integerT::integer(n)- Signed 64-bit integerT::boolean(b)- Boolean as tagged unitT::text(s)- UTF-8 stringT::binary(bytes)- Raw byte data
Composite Types
T::tag(name, value)- Tagged union / sum typeT::record(fields)- Key-value map (like a struct)T::list(items)- Ordered list
Encoding
let value = T::text("hello");
let encoded = value.encode(); // Returns Vec<u8>
let as_string = String::from_utf8_lossy(&encoded);
Learn More
- Check out the comprehensive test suite for more examples
- View the netencode tools: netencode-pretty, netencode-filter
- Read about the format: https://github.com/Profpatsch/netencode
Happy coding! 🚀