sal/README.md
2025-04-02 08:45:47 +02:00

74 lines
1.9 KiB
Markdown

# SAL (System Abstraction Layer)
A Rust library that provides a unified interface for interacting with operating system features across different platforms. It abstracts away platform-specific details, allowing developers to write cross-platform code with ease.
## Features
- **File System Operations**: Simplified file and directory management
- **Process Management**: Create, monitor, and control processes
- **System Information**: Access system details and metrics
- **Git Integration**: Interface with Git repositories
- **Redis Client**: Robust Redis connection management and command execution
- **Text Processing**: Utilities for text manipulation and formatting
## Modules
### Redis Client
The Redis client module provides a robust wrapper around the Redis client library for Rust, offering:
- Automatic connection management and reconnection
- Support for both Unix socket and TCP connections
- Database selection via environment variables
- Thread-safe global client instance
- Simple command execution interface
[View Redis Client Documentation](src/redisclient/README.md)
### OS Module
Provides platform-independent interfaces for operating system functionality.
### Git Module
Tools for interacting with Git repositories programmatically.
### Process Module
Utilities for process creation, monitoring, and management.
### Text Module
Text processing utilities for common operations.
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
sal = "0.1.0"
```
Basic example:
```rust
use sal::redisclient::execute;
use redis::cmd;
fn main() -> redis::RedisResult<()> {
// Execute a Redis command
let mut cmd = redis::cmd("SET");
cmd.arg("example_key").arg("example_value");
execute(&mut cmd)?;
// Retrieve the value
let mut get_cmd = redis::cmd("GET");
get_cmd.arg("example_key");
let value: String = execute(&mut get_cmd)?;
println!("Value: {}", value);
Ok(())
}
```