Skip to main content

Crate minio

Crate minio 

Source
Expand description

§MinIO Rust SDK (minio-rs)

This crate provides a strongly-typed, async-first interface to the MinIO and Amazon S3-compatible object storage APIs.

Each supported S3 operation has a corresponding request builder (e.g., s3::builders::BucketExists, s3::builders::PutObject, s3::builders::UploadPartCopy), which allows users to configure request parameters using a fluent builder pattern.

All request builders implement the s3::types::S3Api trait, which provides the async send method to execute the request and return a typed response.

§Basic Usage

use minio::s3::MinioClient;
use minio::s3::creds::StaticProvider;
use minio::s3::http::BaseUrl;
use minio::s3::types::S3Api;
use minio::s3::response::BucketExistsResponse;

#[tokio::main]
async fn main() {
    let base_url = "http://localhost:9000".parse::<BaseUrl>().unwrap();
    let static_provider = StaticProvider::new("minioadmin", "minioadmin", None);
    let client = MinioClient::new(base_url, Some(static_provider), None, None).unwrap();

    let exists: BucketExistsResponse = client
        .bucket_exists("my-bucket").unwrap()
        .build()
        .send()
        .await
        .expect("request failed");

    println!("Bucket exists: {}", exists.exists());
}

§Features

  • Request builder pattern for ergonomic API usage
  • Full async/await support via tokio
  • Strongly-typed responses
  • Transparent error handling via Result<T, Error>

§Design

Modules§

s3
Implementation of Simple Storage Service (aka S3) client

Macros§

impl_from_s3response
Implements the FromS3Response trait for the specified types.
impl_from_s3response_with_size
Implements the FromS3Response trait for the specified types with an additional object_size field.
impl_has_s3fields
Implements the HasS3Fields trait for the specified types.