- Rust 100%
| .forgejo/workflows | ||
| src | ||
| tests | ||
| .gitignore | ||
| Cargo.toml | ||
| LICENSE | ||
| README.md | ||
estd – Extended Standard Library
A self-contained, interoperable Rust library bridging Rust and Go standard libraries. No external dependencies — only Rust std.
Using idiomatic Rust patterns (Builder, From/Into, Iterators, Error Handling) for modular, reusable components and idiomatic Rust 2024 features.
Author: Damien FLETY
License: ISC
Overview
estd provides Go-like standard library features while leveraging Rust's performance, safety, and modularity. All modules are optional via Cargo features and designed for interoperability and reusability.
Design Principles
- Self-Contained: No external dependencies, only Rust
std - Modular & Composable: Each module is standalone with clear interfaces
- Async/Streaming First: Native async and streaming support across modules
- Extensible: Custom implementations via traits and adapters
- Idiomatic Rust: Builder patterns, From/Into conversions, Iterators, comprehensive error handling
Quick Start
Add estd to your Cargo.toml:
[dependencies]
estd = { path = ".", features = ["sync", "async", "log", "net"] }
Enable only the modules you need. All features:
[dependencies]
estd = { path = ".", features = ["all"] }
Modules
1. Concurrency (estd::sync)
Concurrency primitives with async and streaming support.
- Goroutines: Lightweight tasks using
std::thread - Channels: MPSC/SPMC channels with async support
- Sync Primitives: Mutex, WaitGroup, Once, Select
- Uses:
estd::asyncfor async channels
2. Async Runtime (estd::async_rt)
Minimal async runtime for futures, I/O, and timers.
- Futures: Custom
Futuretrait and utilities - Executor: Polls futures to completion
- Reactor: I/O readiness with
epoll/kqueue - Timers: Async timers and timeouts
- Streams: Async streams for data processing
3. Networking (estd::net::http)
HTTP server and client with async and streaming support.
- Server: Async HTTP server with routing
- Client: Async HTTP client
- Request/Response: Async and streaming handling
- Middleware: Async middleware support
4. Serialization (estd::encoding)
Serde-like serialization/deserialization with async and streaming support.
- Traits:
SerializeandDeserializeinterfaces - Formats: JSON, binary, TOML, YAML (all with async support)
- Extensible: Support for custom formats
5. File I/O (estd::fs)
File and OS utilities with async and streaming support.
- Async Operations: Non-blocking file reads/writes
- Globbing: Async and streaming file globbing
- Path Utilities: Cross-platform path handling
6. Logging (estd::log)
Structured logging with async/streaming support.
- Structured Logging: Key-value pairs for machine-readable logs
- Async Logging: Non-blocking with levels (Info, Warn, Error, etc.)
- Streaming: Stream logs to files/stdout
- Custom Formatting: Sinks and formatters
7. Tracing (estd::trace)
Distributed tracing and observability.
- Spans: Logical units of work (HTTP requests, background tasks)
- Events: Annotations within spans
- Context Propagation: Trace IDs and baggage across async boundaries
- Exporters: Export traces to files, stdout, or custom sinks
8. Context (estd::context)
Context for cancellation, deadlines, and trace propagation.
- Cancellation: Async cancellation support
- Deadlines: Timeout handling
- Values: Request-scoped values
- Trace Context: Embed trace IDs and baggage
9. CLI (estd::flag)
Command-line flag parsing.
- Flag Parsing: Command-line argument parsing
- Extensible: Support for custom flag types
10. Time (estd::time)
Time utilities with async support.
- Timers: Async timers
- Durations: Time duration handling
11. Randomness (estd::rand)
Pseudo-random number generation.
- PRNG: Cryptographically-safe random number generator
- Iterators: Generate sequences of random numbers
12. Strings (estd::strings)
String manipulation utilities.
- String Functions: Common string operations
- Iterator Support: Efficient string processing
13. Environment (estd::env)
Environment variable utilities.
- Variable Access: Read and manipulate environment variables
- Type Conversion: From/Into conversions
14. Templating (estd::text)
Text templating.
- Template Rendering: Render text templates
- Extensible: Custom template expressions and functions
15. Patterns (estd::patterns)
Common Rust patterns for building interoperable libraries.
- Builder Pattern: Generic builder utilities
- Conversions: From/Into trait implementations
- Iterators: Iterator adapters for streams and collections
- Error Handling: Custom error types and Result extensions
- Trait Objects: Dynamic dispatch utilities
Common Patterns Across Modules
All modules follow idiomatic Rust practices:
| Pattern | Usage |
|---|---|
| Builder | Configure complex objects (servers, loggers, channels) |
| From/Into | Type conversions between primitives and wrappers |
| Iterator | Iterate over results, streams, collections |
| Error Handling | Module-specific error types with context |
| Trait Objects | Dynamic dispatch for handlers, middleware, sinks |
Extensibility
estd is designed for easy extension:
- Traits: Core traits allow custom implementations
- Adapters: Extend modules with custom backends
- Modularity: Mix and match with external crates or your code
License
This project is licensed under the ISC License. See LICENSE for details.