Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Dec 17, 2025

Summary

This PR adds a full Rust implementation of the lino-objects-codec library, providing feature parity with the existing Python and JavaScript implementations.

Implementation Details

  • New LinoValue enum: Custom value type supporting all serializable types:

    • Null, Bool(bool), Int(i64), Float(f64), String(String)
    • Array(Vec<LinoValue>), Object(Vec<(String, LinoValue)>)
    • Note: Using a custom type instead of serde_json::Value because JSON doesn't support NaN/Infinity
  • Full API parity:

    • encode() and decode() convenience functions
    • ObjectCodec struct for direct usage
    • Helper methods like LinoValue::object(), LinoValue::array(), accessor methods
  • Features:

    • All basic types (null, bool, int, float, string)
    • Special float values (NaN, Infinity, -Infinity) - unlike JSON!
    • Collections (array, object)
    • Circular reference detection and handling
    • UTF-8 string support via base64 encoding
    • Comprehensive error handling with CodecError

Files Added

  • rust/Cargo.toml - Package configuration
  • rust/src/lib.rs - Main implementation with 18 unit tests and doc tests
  • rust/examples/basic_usage.rs - Usage example
  • rust/README.md - Rust-specific documentation

Updates

  • .github/workflows/test.yml - Added Rust CI job (cargo test, fmt, clippy)
  • README.md - Updated to include Rust in multi-language support docs

Test Plan

  • All 18 unit tests pass (cargo test)
  • All 3 doc tests pass
  • Code formatted with cargo fmt --check
  • No clippy warnings (cargo clippy -- -D warnings)
  • Example runs successfully (cargo run --example basic_usage)
  • CI workflow includes Rust tests

Fixes #8

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #8
@konard konard self-assigned this Dec 17, 2025
Implements a full Rust version of the Links Notation objects codec with:
- LinoValue enum supporting all types (Null, Bool, Int, Float, String, Array, Object)
- Full support for special float values (NaN, Infinity, -Infinity)
- encode() and decode() functions matching Python/JS API
- ObjectCodec struct for direct usage
- Comprehensive test coverage (18 tests)
- Basic usage example
- Documentation with rustdoc comments

Also updates:
- CI workflow to include Rust tests (cargo test, fmt, clippy)
- Main README with Rust documentation and examples

Fixes #8

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Support Rust Support Rust Dec 17, 2025
@konard konard marked this pull request as ready for review December 17, 2025 18:12
@konard
Copy link
Member Author

konard commented Dec 17, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $7.755386 USD
  • Calculated by Anthropic: $5.403860 USD
  • Difference: $-2.351526 (-30.32%)
    📎 Log file uploaded as GitHub Gist (1151KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Rust

2 participants