CodeUChain Rust: Memory-Safe Implementation
CodeUChain provides a memory-safe framework for chaining processing links with middleware support and ownership guarantees.
🤖 LLM Support
This package supports the llm.txt standard for easy AI/LLM integration. See llm-full.txt for comprehensive documentation.
Features
- Context: Immutable by default, mutable for flexibility—embracing Rust's ownership model.
- Link: Selfless processors, async and ecosystem-rich.
- Chain: Harmonious connectors with conditional flows.
- Middleware: Gentle enhancers, optional and forgiving.
- Error Handling: Compassionate routing and retries.
Installation
Add this to your Cargo.toml
:
[]
= "0.1.0"
= { = "1.0", = ["full"] }
Quick Start
use ;
use HashMap;
async
Architecture
Core Module (src/core/
)
Context
: Immutable data container with serde integrationLink
: Async trait for processing unitsChain
: Orchestrator for link executionMiddleware
: Trait for cross-cutting concerns
Utils Module (src/utils/
)
- Error Handling: Retry mechanisms and error routing
- Common Utilities: Shared functionality across implementations
Examples (examples/
)
- Components: Reusable implementations
- Simple Math: Basic usage demonstration
Usage Patterns
1. Basic Usage (Library Components)
use ;
use ;
use HashMap;
let mut chain = new;
chain.add_link;
chain.use_middleware;
2. Custom Components (Project-Specific)
use async_trait;
use ;
use Value;
;
3. Project Composition (Human Oversight)
use BasicChain;
let mut chain = new;
chain.add_link;
chain.use_middleware;
Design Approach
Optimized for Rust's safety and performance—memory-safe, async-native, with zero-cost abstractions. Start fresh, build reliable processing pipelines.
Running Examples
# Run the simple math example
# Run tests
Development
# Build
# Run all tests
# Run specific test
# Check code
# Format code
# Lint code