Skip to main content

minio/
lib.rs

1// MinIO Rust Library for Amazon S3 Compatible Cloud Storage
2// Copyright 2022 MinIO, Inc.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! # MinIO Rust SDK (`minio-rs`)
17//!
18//! This crate provides a strongly-typed, async-first interface to the MinIO and Amazon S3-compatible object storage APIs.
19//!
20//! Each supported S3 operation has a corresponding request builder (e.g., [`s3::builders::BucketExists`], [`s3::builders::PutObject`], [`s3::builders::UploadPartCopy`]),
21//! which allows users to configure request parameters using a fluent builder pattern.
22//!
23//! All request builders implement the [`s3::types::S3Api`] trait, which provides the async [`send`](crate::s3::types::S3Api::send) method
24//! to execute the request and return a typed response.
25//!
26//! ## Basic Usage
27//!
28//! ```no_run
29//! use minio::s3::MinioClient;
30//! use minio::s3::creds::StaticProvider;
31//! use minio::s3::http::BaseUrl;
32//! use minio::s3::types::S3Api;
33//! use minio::s3::response::BucketExistsResponse;
34//!
35//! #[tokio::main]
36//! async fn main() {
37//!     let base_url = "http://localhost:9000".parse::<BaseUrl>().unwrap();
38//!     let static_provider = StaticProvider::new("minioadmin", "minioadmin", None);
39//!     let client = MinioClient::new(base_url, Some(static_provider), None, None).unwrap();
40//!
41//!     let exists: BucketExistsResponse = client
42//!         .bucket_exists("my-bucket").unwrap()
43//!         .build()
44//!         .send()
45//!         .await
46//!         .expect("request failed");
47//!
48//!     println!("Bucket exists: {}", exists.exists());
49//! }
50//! ```
51//!
52//! ## Features
53//! - Request builder pattern for ergonomic API usage
54//! - Full async/await support via [tokio](https://tokio.rs/)
55//! - Strongly-typed responses
56//! - Transparent error handling via `Result<T, Error>`
57//!
58//! ## Design
59//! - Each API method on the [`s3::client::MinioClient`] returns a builder struct
60//! - Builders implement [`s3::types::ToS3Request`] for request conversion and [`s3::types::S3Api`] for execution
61//! - Responses implement [`s3::types::FromS3Response`] for consistent deserialization
62
63#![allow(clippy::result_large_err)]
64#![allow(clippy::too_many_arguments)]
65pub mod s3;
66
67#[cfg(test)]
68#[macro_use]
69extern crate quickcheck;