Expand description
Tokio-based file reading implementation for reqsign.
This crate provides TokioFileRead, an async file reader that implements
the FileRead trait from reqsign_core using Tokio’s file system operations.
§Overview
TokioFileRead enables reqsign to read files asynchronously using Tokio’s
efficient async I/O primitives. This is particularly useful when loading
credentials or configuration from the file system.
§Example
use reqsign_core::{Context, OsEnv};
use reqsign_file_read_tokio::TokioFileRead;
#[tokio::main]
async fn main() {
// Create a context with Tokio file reader
let ctx = Context::new()
.with_file_read(TokioFileRead::default())
.with_env(OsEnv);
// The context can now read files asynchronously
match ctx.file_read("/path/to/credentials.json").await {
Ok(content) => println!("Read {} bytes", content.len()),
Err(e) => eprintln!("Failed to read file: {}", e),
}
}§Usage with Service Signers
use reqsign_core::Context;
use reqsign_file_read_tokio::TokioFileRead;
// Many cloud services require reading credentials from files
let ctx = Context::new()
.with_file_read(TokioFileRead::default());
// Create a signer that can load credentials from files
// let signer = Signer::new(ctx, credential_loader, request_builder);Structs§
- Tokio
File Read - Tokio-based implementation of the
FileReadtrait.