Expand description
Async, streaming S3-compatible client with explicit resource bounds.
s3-wire provides typed object operations, SigV4 signing, replay-aware
retries, streaming downloads, and primitive or managed multipart uploads.
A client is configured for one endpoint, region, and bucket; cheap
bucket-scoped handles can share its connection pool.
§Quick start
The default credential provider reads AWS_ACCESS_KEY_ID,
AWS_SECRET_ACCESS_KEY, and optional AWS_SESSION_TOKEN.
use s3_wire::{
ByteStream, Endpoint, GetObjectRequest, ObjectKey, PutObjectRequest, S3Client, S3Config,
};
let region = "us-east-1";
let config = S3Config::builder()
.endpoint(Endpoint::for_aws_region(region)?)
.region(region)
.bucket("artifact-bucket")
.build()?;
let client = S3Client::new(config)?;
let key = ObjectKey::new("reports/latest.json")?;
client
.put_object(PutObjectRequest::new(
key.clone(),
ByteStream::from_bytes(br#"{"status":"complete"}"#.as_slice()),
))
.await?;
let download = client.get_object(GetObjectRequest::new(key)).await?;
let mut destination = tokio::io::sink();
download.body.write_to(&mut destination).await?;§Upload and download behavior
ByteStream::from_bytesandByteStream::from_pathare replayable.ByteStream::from_streamis one-shot and requires an exact length and SHA-256 digest.ResponseStreamapplies backpressure and validates declared length, configured deadlines, and supported checksums while the body is consumed.S3Client::multipart_uploadbounds concurrent part buffers and owns abort cleanup after S3 creates an upload.
§Errors
S3Error exposes a stable ErrorCategory, service status and code,
request identifiers, retry classification, attempt count, retry stop reason,
timeout phase, and any multipart cleanup failure. Formatting remains
redacted by default.
§More documentation
Structs§
- Abort
Multipart Upload Request - Request to abort an in-progress multipart upload.
- AwsDefault
Credentials Provider - Adapter for AWS’s standard renewable credential provider chain.
- Byte
Stream - An upload body with explicit length, integrity, and replay semantics.
- Cached
Credentials Provider - Expiration-aware provider that coalesces concurrent refresh requests.
- Checksum
- Base64-encoded checksums returned by S3.
- Checksum
Calculation Error - Failure to calculate a requested checksum locally.
- Complete
Multipart Upload Output - Result of completing a multipart upload.
- Complete
Multipart Upload Request - Request to complete a multipart upload.
- Completed
Part - A validated completed-part descriptor.
- Conditions
- Conditional headers shared by object operations.
- Copy
Object Output - Result of a server-side copy.
- Copy
Object Request - Request to copy an object within S3.
- Copy
Part Range - Inclusive source byte range for one server-side copied part.
- Copy
Source - Source of a server-side object copy.
- Create
Multipart Upload Output - Result of initiating a multipart upload.
- Create
Multipart Upload Request - Request to initiate a multipart upload.
- Credentials
- AWS-compatible credentials and optional expiration.
- Delete
Error - Per-object failure returned from a multi-object delete.
- Delete
Object Identifier - One object selected for a multi-object delete request.
- Delete
Object Output - Result of deleting one object.
- Delete
Object Request - Request to delete one object.
- Delete
Objects Output - Result of a multi-object delete request.
- Delete
Objects Request - A validated multi-object delete request.
- Deleted
Object - One successfully deleted object.
- Download
ToPath Output - Result of an atomic object download to a local path.
- Endpoint
- A validated S3 service endpoint.
- Environment
Credentials Provider - Provider for the conventional AWS credential environment variables.
- GetObject
Output - A streaming object download and its response metadata.
- GetObject
Request - Request to download one object.
- Head
Object Request - Request to inspect object metadata without retrieving the body.
- List
Multipart Uploads Output - One page of in-progress multipart uploads.
- List
Multipart Uploads Request - Request for one page of in-progress multipart uploads.
- List
Objects V2Output - One parsed
ListObjectsV2page. - List
Objects V2Request - Request for one
ListObjectsV2page. - List
Parts Output - One bounded page returned by
ListParts. - List
Parts Request - Request for one page of parts belonging to an in-progress upload.
- Listed
Object - One object returned by
ListObjectsV2. - Listed
Part - One uploaded part returned by
ListParts. - Managed
Multipart Headers - Phase-specific headers for a managed multipart upload.
- Managed
Multipart Upload Request - Request for a bounded, automatically cleaned-up multipart upload.
- Multipart
Options - Validated resource and time bounds for one managed multipart upload.
- Multipart
Upload - Explicit state needed to resume or clean up an in-progress multipart upload.
- Multipart
Upload Entry - One in-progress multipart upload returned by the service.
- Object
Key - A validated UTF-8 S3 object key.
- Object
Metadata - Metadata common to object retrieval and inspection responses.
- Object
Owner - Owner information optionally returned for a listed object.
- Page
Size - Validated S3 listing page size in the range 1 through 1,000.
- Part
Number - A validated multipart part number in the range 1 through 10,000.
- Presigned
Url - A presigned URL whose standard formatting is always redacted.
- PutObject
Output - Result of uploading one object.
- PutObject
Request - Request to upload one object.
- Range
Error - Invalid inclusive byte range.
- Request
Event - Sanitized lifecycle event for an S3 request attempt.
- Request
Ids - Identifiers supplied by an S3-compatible service for diagnostics.
- Response
Stream - A download stream that enforces idle timeout, content length, and any supported full-object checksum returned by S3.
- Retry
Policy - Bounded exponential-backoff policy with full jitter.
- S3Client
- An async S3-compatible client.
- S3Config
- Validated configuration used to construct an S3 client.
- S3Config
Builder - Builder for
S3Config. - S3Error
- A structured S3 client error.
- Static
Credentials Provider - Provider backed by an immutable credential value.
- Upload
Id - An opaque, validated multipart upload identifier issued by an S3 service.
- Upload
Part Copy Output - Result of copying an existing object or range into one multipart part.
- Upload
Part Copy Request - Request to populate a multipart part from an existing S3 object.
- Upload
Part Output - Result of uploading one multipart part.
- Upload
Part Request - Request to upload one multipart part.
Enums§
- Addressing
Style - How a bucket name is represented in request URLs.
- AwsEndpoint
Variant - Standard AWS S3 endpoint variant.
- Byte
Range - A byte range for a GET request.
- Checksum
Algorithm - Checksum algorithm understood by S3 checksum headers.
- Checksum
Type - How S3 derives an object checksum from multipart data.
- Copy
Metadata Directive - Metadata behavior for a server-side copy.
- Delete
Objects Error - Invalid multi-object delete batch.
- Error
Category - Broad category suitable for programmatic error handling.
- Multipart
Error - Invalid multipart state or descriptor.
- Object
KeyError - Validation failure for an
ObjectKey. - Request
Event Kind - Stage of one request attempt.
- Retry
Classification - Whether an operation may be retried after an error.
- Retry
Stop Reason - Why a retryable request stopped without another attempt.
- Timeout
Phase - The phase in which a timeout occurred.
- Upload
IdError - Why a service-issued multipart upload identifier was rejected.
Traits§
- Credentials
Provider - Asynchronous source of AWS-compatible credentials.
- Request
Observer - Receives sanitized request lifecycle events.
Functions§
- resolve_
aws_ region_ for_ profile - Resolves a signing region through AWS’s standard chain for a named profile.
- resolve_
default_ aws_ region - Resolves a signing region through AWS’s standard environment, shared profile, and IMDS region chain.
Type Aliases§
- Head
Object Output - Result of inspecting an object.