### Rust: Create and Configure MinIO ClientBuilder Source: https://docs.rs/minio/latest/minio/s3/client/struct Demonstrates the creation of a `ClientBuilder` with a base URL and subsequent configuration options. This builder is used to manufacture a `Client` for interacting with MinIO or other S3-compatible services. Dependencies include the `minio` crate. ```rust use minio::s3::client::ClientBuilder; use minio::s3::base_url::BaseUrl; // Example usage: let base_url = BaseUrl::new("http://localhost:9000".to_string(), false); let builder = ClientBuilder::new(base_url) .provider(None) // Use anonymous access .app_info(Some(("my_app".to_string(), "1.0.0".to_string()))) .ssl_cert_file(None) .ignore_cert_check(Some(false)); match builder.build() { Ok(client) => { println!("Client built successfully!"); // Use the client here } Err(e) => { eprintln!("Error building client: {}", e); } } ``` -------------------------------- ### Iterator Trait Implementations for SegmentedBytesIterator in Rust Source: https://docs.rs/minio/latest/minio/s3/segmented_bytes/struct Demonstrates various standard Rust Iterator trait implementations for the SegmentedBytesIterator. These include methods for getting the next item, estimating remaining elements, and consuming the iterator. ```rust impl Iterator for SegmentedBytesIterator<'_> { type Item = Bytes; fn next(&mut self) -> Option; fn next_chunk( &mut self, ) -> Result<[Self::Item; N], IntoIter> where Self: Sized; fn size_hint(&self) -> (usize, Option); fn count(self) -> usize where Self: Sized; fn last(self) -> Option where Self: Sized; fn advance_by(&mut self, n: usize) -> Result<(), NonZero>; fn nth(&mut self, n: usize) -> Option; fn step_by(self, step: usize) -> StepBy where Self: Sized; fn chain(self, other: U) -> Chain::IntoIter> where Self: Sized, U: IntoIterator; fn zip(self, other: U) -> Zip::IntoIter> where Self: Sized, U: IntoIterator; fn intersperse(self, separator: Self::Item) -> Intersperse where Self: Sized, Self::Item: Clone; fn intersperse_with(self, separator: G) -> IntersperseWith where Self: Sized, G: FnMut() -> Self::Item; fn map(self, f: F) -> Map where Self: Sized, F: FnMut(Self::Item) -> B; fn for_each(self, f: F) where Self: Sized, F: FnMut(Self::Item); fn filter

(self, predicate: P) -> Filter where Self: Sized, P: FnMut(&Self::Item) -> bool; fn filter_map(self, f: F) -> FilterMap where Self: Sized, F: FnMut(Self::Item) -> Option; fn enumerate(self) -> Enumerate where Self: Sized; fn peekable(self) -> Peekable where Self: Sized; fn skip_while

(self, predicate: P) -> SkipWhile where Self: Sized, P: FnMut(&Self::Item) -> bool; fn take_while

(self, predicate: P) -> TakeWhile where Self: Sized, P: FnMut(&Self::Item) -> bool; fn map_while(self, predicate: P) -> MapWhile where Self: Sized, P: FnMut(Self::Item) -> Option; fn skip(self, n: usize) -> Skip where Self: Sized; } ``` -------------------------------- ### Rust: Building a MinIO Client Source: https://docs.rs/minio/latest/minio/s3/client/struct Shows the final step of building a `Client` instance from a configured `ClientBuilder`. The `build` method returns a `Result` which can be either a successful `Client` or an `Error`. This is a core part of initializing the MinIO client. ```rust use minio::s3::client::{Client, ClientBuilder, Error}; use minio::s3::base_url::BaseUrl; // Assuming builder is already configured: let base_url = BaseUrl::new("http://localhost:9000".to_string(), false); let builder = ClientBuilder::new(base_url); let result: Result = builder.build(); match result { Ok(client) => { println!("MinIO client initialized."); // Perform operations with the client } Err(err) => { eprintln!("Failed to initialize MinIO client: {}", err); } } ``` -------------------------------- ### Basic Usage of MinIO Rust SDK Source: https://docs.rs/minio/latest/minio/index Demonstrates the fundamental usage of the minio-rs crate to check if a bucket exists. It initializes a client, uses the `bucket_exists` builder, and sends the asynchronous request, handling potential errors. ```rust use minio::s3::Client; use minio::s3::types::S3Api; use minio::s3::response::BucketExistsResponse; #[tokio::main] async fn main() { let client: Client = Default::default(); // configure your client let exists: BucketExistsResponse = client .bucket_exists("my-bucket") .send() .await .expect("request failed"); println!("Bucket exists: {}", exists.exists); } ``` -------------------------------- ### StaticProvider Constructor Source: https://docs.rs/minio/latest/minio/s3/creds/struct This section details how to create a new StaticProvider instance with access key, secret key, and an optional session token. ```APIDOC ## `new` - StaticProvider ### Description Returns a static provider with given access key, secret key and optional session token. ### Method `pub fn new( access_key: &str, secret_key: &str, session_token: Option<&str>, ) -> StaticProvider` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust use minio::s3::creds::StaticProvider; let provider = StaticProvider::new("minioadmin", "minio123", None); ``` ### Response #### Success Response (200) `StaticProvider` instance. #### Response Example ```json { "provider": "StaticProvider" } ``` ``` -------------------------------- ### ClientBuilder API Source: https://docs.rs/minio/latest/minio/s3/client/struct This section details the methods available on the ClientBuilder struct for configuring and building a Minio S3 client. ```APIDOC ## Struct ClientBuilder ### Description Client Builder manufactures a Client using given parameters. ## impl ClientBuilder ### `pub fn new(base_url: BaseUrl) -> Self` #### Description Creates a builder given a base URL for the MinIO service or other AWS S3 compatible object storage service. #### Parameters * `base_url` (BaseUrl) - The base URL for the MinIO service. ### `pub fn provider(self, provider: Option>) -> Self` #### Description Set the credential provider. If not set anonymous access is used. #### Parameters * `provider` (Option>) - The credential provider to use. ### `pub fn app_info(self, app_info: Option<(String, String)>) -> Self` #### Description Set the app info as an Option of (app_name, app_version) pair. This will show up in the client’s user-agent. #### Parameters * `app_info` (Option<(String, String)>) - The application name and version. ### `pub fn ssl_cert_file(self, ssl_cert_file: Option<&Path>) -> Self` #### Description Set file for loading CAs certs to trust. This is in addition to the system trust store. The file must contain PEM encoded certificates. #### Parameters * `ssl_cert_file` (Option<&Path>) - Path to the SSL certificate file. ### `pub fn ignore_cert_check(self, ignore_cert_check: Option) -> Self` #### Description Set flag to ignore certificate check. This is insecure and should only be used for testing. #### Parameters * `ignore_cert_check` (Option) - Whether to ignore certificate checks. ### `pub fn build(self) -> Result` #### Description Build the Client. #### Returns * `Result` - A Result containing the constructed Client or an Error. ``` -------------------------------- ### Presigned URL and Utility Argument Builders Source: https://docs.rs/minio/latest/minio/s3/builders/index Argument builders for generating presigned URLs and other utility operations. ```APIDOC ## Module minio::s3::client::Client ### Description Argument builders for Minio S3 client APIs related to presigned URLs and utility functions. ### Structs #### GetPresignedObjectUrl This struct constructs the parameters required for the `Client::get_presigned_object_url` method. #### GetPresignedPolicyFormData This struct constructs the parameters required for the `Client::get_presigned_object_url` method. ### Functions #### calc_part_info Returns the size of each part to upload and the total number of parts. The number of parts is `None` when the object size is unknown. ``` -------------------------------- ### Create UploadPart Instance in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Provides the constructor for the `UploadPart` struct, initializing it with necessary parameters for an S3 upload part operation. Requires a client, bucket name, object key, upload ID, part number, and the data segment. ```rust pub fn new( client: Client, bucket: String, object: String, upload_id: String, part_number: u16, data: SegmentedBytes, ) -> Self ``` -------------------------------- ### SseS3 Constructor and Methods (Rust) Source: https://docs.rs/minio/latest/minio/s3/sse/struct Provides the implementation for the SseS3 struct, including a public constructor `new()` to create instances, and methods for generating headers for regular and copy operations. ```rust impl SseS3 { pub fn new() -> Self } impl Sse for SseS3 { fn headers(&self) -> Multimap fn copy_headers(&self) -> Multimap fn tls_required(&self) -> bool fn as_any(&self) -> &dyn Any } ``` -------------------------------- ### Provider Trait Implementation Source: https://docs.rs/minio/latest/minio/s3/creds/struct Details the implementation of the Provider trait for StaticProvider, specifically the `fetch` method. ```APIDOC ## `fetch` - StaticProvider ### Description Fetches credentials from the static provider. ### Method `fn fetch(&self) -> Credentials` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```rust // Assuming 'provider' is an instance of StaticProvider let credentials = provider.fetch(); ``` ### Response #### Success Response (200) `Credentials` object containing the static access key, secret key, and session token. #### Response Example ```json { "access_key": "minioadmin", "secret_key": "minio123", "session_token": null } ``` ``` -------------------------------- ### Create StaticProvider Instance Source: https://docs.rs/minio/latest/minio/s3/creds/struct Instantiates a StaticProvider with static AWS credentials. This provider is suitable for scenarios where credentials do not change and can be hardcoded or loaded from a configuration. It requires an access key and a secret key, with an optional session token for temporary credentials. ```rust use minio::s3::creds::StaticProvider; // Example with only access and secret keys let provider = StaticProvider::new("minioadmin", "minio123", None); // Example with access key, secret key, and session token // let provider_with_session = StaticProvider::new("minioadmin", "minio123", Some("my-session-token")); ``` -------------------------------- ### Bucket Operations Argument Builders Source: https://docs.rs/minio/latest/minio/s3/builders/index Argument builders for S3 bucket operations, including creation, listing, and configuration management. ```APIDOC ## Module minio::s3::client::Client ### Description Argument builders for Minio S3 client APIs related to bucket operations. ### Structs #### BucketCommon Common parameters for bucket operations #### CreateBucket Argument builder for the `CreateBucket` S3 API operation. #### DeleteObjects #### GetBucketLifecycle Argument builder for the `GetBucketLifecycle` S3 API operation. #### GetBucketTagging Argument builder for the `GetBucketTagging` S3 API operation. #### GetRegion Argument builder for the `GetRegion` S3 API operation. #### ListBuckets Argument builder for the `ListBuckets` S3 API operation. #### ListObjects Argument builder for list_objects() API. #### ListenBucketNotification Argument builder for the `ListenBucketNotification` #### PostPolicy Post policy information for presigned post policy form-data #### PutBucketEncryption Argument builder for the `PutBucketEncryption` S3 API operation. #### PutBucketLifecycle Argument builder for the `PutBucketLifecycle` S3 API operation. #### PutBucketNotification Argument builder for the `PutBucketNotification` S3 API operation. #### PutBucketPolicy Argument builder for the `PutBucketPolicy` S3 API operation. #### PutBucketReplication Argument builder for the `PutBucketReplication` S3 API operation. #### PutBucketTagging Argument builder for the `PutBucketTagging` S3 API operation. #### PutBucketVersioning Argument builder for the `PutBucketVersioning` S3 API operation. ``` -------------------------------- ### Initialize GetObjectLockConfig Builder (Rust) Source: https://docs.rs/minio/latest/minio/s3/builders/type This function is a constructor for the BucketCommon struct, which is used here as the base for the GetObjectLockConfig builder. It requires a Client instance and the bucket name as input, returning a new instance of BucketCommon ready for further configuration. ```rust pub fn new(client: Client, bucket: String) -> BucketCommon ``` -------------------------------- ### Generic Implementations for UploadPart in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Showcases various blanket implementations for `UploadPart`, including `Freeze`, `!RefUnwindSafe`, `Send`, `Sync`, `Unpin`, `!UnwindSafe`, `Any`, `Borrow`, `BorrowMut`, `CloneToUninit`, `From`, `Instrument`, `Into`, `PolicyExt`, `Same`, `ToOwned`, and `TryFrom`/`TryInto`. These traits provide fundamental capabilities and interoperability. ```rust impl Freeze for UploadPart impl !RefUnwindSafe for UploadPart impl Send for UploadPart impl Sync for UploadPart impl Unpin for UploadPart impl !UnwindSafe for UploadPart ``` ```rust impl Any for T where T: 'static + ?Sized, typeid(&self) -> TypeId ``` ```rust impl Borrow for T where T: ?Sized, borrow(&self) -> &T ``` ```rust impl BorrowMut for T where T: ?Sized, borrow_mut(&mut self) -> &mut T ``` ```rust impl CloneToUninit for T where T: Clone, unsafe fn clone_to_uninit(&self, dest: *mut u8) ``` ```rust impl From for T from(t: T) -> T ``` ```rust impl Instrument for T instrument(self, span: Span) -> Instrumented in_current_span(self) -> Instrumented ``` ```rust impl Into for T where U: From, into(self) -> U ``` ```rust impl PolicyExt for T where T: ?Sized, and(self, other: P) -> And or(self, other: P) -> Or ``` ```rust impl Same for T Output = T ``` ```rust impl ToOwned for T where T: Clone, Owned = T, to_owned(&self) -> T, clone_into(&self, target: &mut T) ``` ```rust impl TryFrom for T where U: Into, Error = Infallible, try_from(value: U) -> Result>::Error> ``` ```rust impl TryInto for T where U: TryFrom ``` -------------------------------- ### UploadPart API Source: https://docs.rs/minio/latest/minio/s3/builders/struct The UploadPart struct and its associated methods for configuring and sending upload part requests. ```APIDOC ## UploadPart ### Description Argument for upload_part() S3 API. This struct is used to configure and send upload part requests. ### Method POST (Implicit, via `send` method) ### Endpoint `/bucket/object?uploadId=...&partNumber=...` (Constructed by the `send` method) ### Parameters #### Constructor Parameters: - **client** (Client) - The Minio client instance. - **bucket** (String) - The name of the bucket. - **object** (String) - The name of the object. - **upload_id** (String) - The upload ID of the multipart upload. - **part_number** (u16) - The part number for this upload. - **data** (SegmentedBytes) - The data for the part. #### Builder Methods: - **extra_headers**(self, extra_headers: Option) -> Self Adds extra headers to the request. - **extra_query_params**(self, extra_query_params: Option) -> Self Adds extra query parameters to the request. - **region**(self, region: Option) -> Self Sets the region for the request. - **sse**(self, sse: Option>) -> Self Configures server-side encryption. - **tags**(self, tags: Option>) -> Self Adds tags to the object. - **retention**(self, retention: Option) -> Self Sets the retention policy for the object. - **legal_hold**(self, legal_hold: bool) -> Self Enables or disables legal hold for the object. ### Request Example ```rust // Assuming `client`, `data`, etc. are defined elsewhere let upload_part_request = UploadPart::new(client, bucket_name, object_name, upload_id, part_number, data) .region(Some("us-east-1".to_string())) .tags(Some(HashMap::from([("key".to_string(), "value".to_string())]))); // To send the request: // let response = upload_part_request.send().await?; ``` ### Response #### Success Response (200) - **PutObjectResponse** (PutObjectResponse) - The response from the S3 API upon successful upload. #### Response Example ```json // Example structure of PutObjectResponse, actual fields may vary { "etag": "\"a1b2c3d4e5f67890\"", "version_id": "some-version-id" } ``` ``` -------------------------------- ### Element Trait Implementations (Rust) Source: https://docs.rs/minio/latest/minio/s3/utils/xml/struct Demonstrates various trait implementations for the Element struct in Rust. These include Clone for duplication, Debug for formatting, and From for type conversions. It also shows blanket implementations for traits like Any, Borrow, and CloneToUninit, expanding Element's capabilities. ```rust impl<'a> Clone for Element<'a> { fn clone(&self) -> Element<'a> } impl<'a> Debug for Element<'a> { fn fmt(&self, f: &mut Formatter<'_>) -> Result } impl<'a> From<&'a Element> for Element<'a> { fn from(value: &'a Element) -> Self } ``` -------------------------------- ### Configure UploadPart Tags in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Applies tags to the uploaded part. Tags are provided as a `HashMap` where keys and values are strings. This configuration is optional. ```rust pub fn tags(self, tags: Option>) -> Self ``` -------------------------------- ### SseS3 Struct and Methods Source: https://docs.rs/minio/latest/minio/s3/sse/struct This section details the SseS3 struct, its constructor, and its implementation of the Sse trait. ```APIDOC ## Struct SseS3 ### Description Server side encryption S3 type. ### Method `pub fn new() -> Self` ### Description Creates a new instance of SseS3. ### Method `fn headers(&self) -> Multimap` ### Description Returns regular headers for SseS3. ### Method `fn copy_headers(&self) -> Multimap` ### Description Returns headers for a copy operation with SseS3. ### Method `fn tls_required(&self) -> bool` ### Description Indicates if TLS is required for SseS3. ### Method `fn as_any(&self) -> &dyn Any` ### Description Returns a reference to the internal data as a dynamic Any type. ``` -------------------------------- ### Rust Blanket Implementation: ToString for T Source: https://docs.rs/minio/latest/minio/s3/http/struct Demonstrates the implementation of the ToString trait for types that also implement Display. This provides a convenient way to convert Url instances to String. ```rust fn to_string(&self) -> String ``` -------------------------------- ### Policy 'And' Implementation in Rust Source: https://docs.rs/minio/latest/minio/s3/lifecycle_config/struct Implements a 'Policy' that returns 'Action::Follow' only if both the 'self' and 'other' policies return 'Action::Follow'. This is useful for combining conditions where all must be met. It leverages generic types for flexibility. ```rust fn and(self, other: P) -> And where T: Policy, P: Policy, { // Implementation details for creating a new Policy combining self and other } ``` -------------------------------- ### Enums and Constants Source: https://docs.rs/minio/latest/minio/s3/builders/index Enumerations and constants used within the Minio S3 client library. ```APIDOC ## Module minio::s3::client::Client ### Description Enums and constants used within the Minio S3 client library. ### Enums #### Size #### VersioningStatus Represents the versioning state of an S3 bucket. ### Constants #### DEFAULT_EXPIRY_SECONDS The default expiry time in seconds for a `GetPresignedObjectUrl`. #### MAX_MULTIPART_COUNT #### MAX_OBJECT_SIZE #### MAX_PART_SIZE #### MIN_PART_SIZE ``` -------------------------------- ### Rust Blanket Implementation: Instrument for T Source: https://docs.rs/minio/latest/minio/s3/http/struct Demonstrates the application of the 'Instrument' trait to generic types, including Url. This allows for integrating spans for tracing and debugging within the Tokio runtime. ```rust fn instrument(self, span: Span) -> Instrumented ``` ```rust fn in_current_span(self) -> Instrumented ``` -------------------------------- ### Configure Extra Query Parameters for GetObjectLockConfig Builder (Rust) Source: https://docs.rs/minio/latest/minio/s3/builders/type This method enables the configuration of optional extra query parameters for the GetObjectLockConfig S3 API request. It accepts an Option, allowing the user to append custom query parameters to the request URL. ```rust pub fn extra_query_params(self, extra_query_params: Option) -> Self ``` -------------------------------- ### Rust Implementation: Url::fmt (Debug) Source: https://docs.rs/minio/latest/minio/s3/http/struct Implements the Debug trait for the Url struct, providing a developer-friendly way to format Url instances for debugging purposes. This allows for easy inspection of URL components. ```rust fn fmt(&self, __f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Url Struct Documentation Source: https://docs.rs/minio/latest/minio/s3/http/struct Details the structure of the Url object used to represent HTTP URLs. ```APIDOC ## Struct Url ### Description Represents HTTP URL ### Fields - **https** (bool) - Indicates if the URL uses HTTPS. - **host** (String) - The hostname of the URL. - **port** (u16) - The port number of the URL. - **path** (String) - The path component of the URL. - **query** (Multimap) - A multimap containing the query parameters of the URL. ### Implementations #### fn host_header_value(&self) -> String Returns the value for the Host header. ### Trait Implementations - **Clone**: Allows duplication of Url objects. - **Debug**: Enables formatting Url objects for debugging. - **Default**: Provides a default Url value. - **Display**: Allows formatting Url objects as strings. #### fn clone(&self) -> Self Returns a duplicate of the value. #### fn clone_from(&mut self, source: &Self) Performs copy-assignment from `source`. #### fn fmt(&self, __f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. #### fn default() -> Self Returns the “default value” for a type. ``` -------------------------------- ### SseS3 Trait Implementations Source: https://docs.rs/minio/latest/minio/s3/sse/struct Details the implementations of standard Rust traits for the SseS3 struct, such as Clone, Debug, and Default. ```APIDOC ## Trait Implementations for SseS3 ### impl Clone for SseS3 #### fn clone(&self) -> SseS3 Description: Returns a duplicate of the value. #### fn clone_from(&mut self, source: &Self) Description: Performs copy-assignment from `source`. ### impl Debug for SseS3 #### fn fmt(&self, f: &mut Formatter<'_>) -> Result Description: Formats the value using the given formatter. ### impl Default for SseS3 #### fn default() -> Self Description: Returns the "default value" for a type. ``` -------------------------------- ### Minio S3 API Structures Source: https://docs.rs/minio/latest/minio/s3/types/index This section outlines the various data structures used for S3 API requests and responses in the Minio Rust client. ```APIDOC ## Minio S3 API Structures ### AccessControlTranslation Access control translation information. ### AndOperator And operator contains prefix and tags. ### Bucket Contains bucket name and creation date. ### CloudFuncConfig Cloud function configuration information. ### CsvInputSerialization CSV input serialization definitions. ### CsvOutputSerialization CSV output serialization definitions. ### Destination Destination information. ### EncryptionConfig Encryption configuration information. ### Filter Filter information. ### JsonInputSerialization JSON input serialization definitions. ### JsonOutputSerialization JSON output serialization definitions. ### ListEntry Contains information of an item of list_objects() API. ### Metrics Metrics information. ### NotificationConfig Notification configuration information. ### NotificationRecord Notification record information. ### NotificationRecords Contains notification records. ### ObjectLockConfig Object lock configuration information. ### ParquetInputSerialization Parquet input serialization definitions. ### Part Contains part number and etag of multipart upload. ### PartInfo ### PrefixFilterRule Prefix filter rule. ### QueueConfig Queue configuration information. ### ReplicationConfig Replication configuration information. ### ReplicationRule Replication rule information. ### ReplicationTime Replication time information. ### RequestParameters Request parameters contain principal ID, region and source IP address, but they are represented as a string-to-string map in the MinIO server. So we provide methods to fetch the known fields and a map for underlying representation. ### ResponseElements Response elements information: they are represented as a string-to-string map in the MinIO server. So we provide methods to fetch the known fields and a map for underlying representation. ### Retention Contains retention mode and retain until date. ### S3 S3 definitions for NotificationRecord. ### S3Bucket S3 bucket information. ### S3Object S3 object information. ### S3Request Generic S3Request. ### SelectProgress Progress information of select_object_content() API. ### SelectRequest Select request for select_object_content() API. ### Source Source information. ### SourceSelectionCriteria Source selection criteria information. ### SseConfig Server-side information configuration. ### SuffixFilterRule Suffix filter rule. ### Tag Contains key and value. ### TopicConfig Topic configuration information. ### UserIdentity User identity contains principal ID. ``` -------------------------------- ### Minio S3 API Functions Source: https://docs.rs/minio/latest/minio/s3/types/index This section lists utility functions for the Minio S3 API. ```APIDOC ## Minio S3 API Functions ### parse_legal_hold Parses legal hold string value. ``` -------------------------------- ### StaticProvider Struct Definition Source: https://docs.rs/minio/latest/minio/s3/creds/struct Defines the structure of StaticProvider. This struct holds the static credentials used for authenticating with S3 services. The internal fields are private, indicating that instantiation should primarily occur through the `new` constructor. ```rust pub struct StaticProvider { /* private fields */ } ``` -------------------------------- ### Default Implementation for UploadPart in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Implements the `Default` trait for `UploadPart`, providing a default constructor. This allows creating an instance of `UploadPart` with sensible default values. ```rust fn default() -> UploadPart ``` -------------------------------- ### Policy 'Or' Implementation in Rust Source: https://docs.rs/minio/latest/minio/s3/lifecycle_config/struct Implements a 'Policy' that returns 'Action::Follow' if either the 'self' or 'other' policy returns 'Action::Follow'. This allows for conditions where at least one must be met. It uses generic types for reusable policy logic. ```rust fn or(self, other: P) -> Or where T: Policy, P: Policy, { // Implementation details for creating a new Policy combining self and other } ``` -------------------------------- ### Rust Blanket Implementation: TryInto for T Source: https://docs.rs/minio/latest/minio/s3/http/struct Illustrates the generic implementation of the TryInto trait, allowing for fallible conversions from a type to another. This complements TryFrom by providing the consuming interface. ```rust type Error = >::Error ``` ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Rust Struct Definition: Url Source: https://docs.rs/minio/latest/minio/s3/http/struct Defines the structure of an HTTP URL, including protocol, host, port, path, and query parameters. This struct is fundamental for handling HTTP requests within the Minio S3 client. ```rust pub struct Url { pub https: bool, pub host: String, pub port: u16, pub path: String, pub query: Multimap, } ``` -------------------------------- ### Configure Extra Headers for GetObjectLockConfig Builder (Rust) Source: https://docs.rs/minio/latest/minio/s3/builders/type This method allows setting optional extra headers for the GetObjectLockConfig S3 API request. It takes an Option as input, enabling the addition of custom headers to the request before it is sent. ```rust pub fn extra_headers(self, extra_headers: Option) -> Self ``` -------------------------------- ### Object Operations Argument Builders Source: https://docs.rs/minio/latest/minio/s3/builders/index Argument builders for common S3 object operations, including uploading, copying, deleting, and retrieving object metadata. ```APIDOC ## Module minio::s3::client::Client ### Description Argument builders for Minio S3 client APIs related to object operations. ### Structs #### AbortMultipartUpload Argument for abort_multipart_upload() API #### AppendObject Argument builder for the `AppendObject` S3 API operation. #### AppendObjectContent Argument builder for the `AppendObject` S3 API operation. #### CompleteMultipartUpload Argument for complete_multipart_upload() API #### ComposeObject Argument builder for `CopyObject` S3 API operation. #### ComposeSource Source object information for compose_object #### CopyObject Argument builder for `CopyObject` S3 API operation. #### CopySource Base argument for object conditional read APIs #### DeleteObject Argument builder for the `RemoveObject` S3 API operation. #### DeleteObjectTagging Argument builder for the `DeleteObjectTagging` S3 API operation. #### DeleteObjectsStreaming Argument builder for the `DeleteObjectsStreaming` S3 API operation. Note that this API is not part of the official S3 API, but is a MinIO extension for streaming deletion of multiple objects. #### GetObject Argument builder for the `GetObject` S3 API operation. #### GetObjectLegalHold Argument builder for the `GetObjectLegalHold` S3 API operation. #### GetObjectPrompt Argument builder for the `GetObjectPrompt` operation. #### GetObjectRetention Argument builder for the `GetObjectRetention` S3 API operation. #### GetObjectTagging Argument builder for the `GetObjectTagging` S3 API operation. #### PutObject Argument builder for PutObject S3 API. This is a lower-level API. #### PutObjectContent PutObjectContent takes a `ObjectContent` stream and uploads it to MinIO/S3. #### PutObjectLegalHold Argument builder for the `PutObjectLegalHold` S3 API operation. #### PutObjectLockConfig Argument builder for the `PutObjectLockConfig` S3 API operation. #### PutObjectRetention Argument builder for the `PutObjectRetention` S3 API operation. #### PutObjectTagging Argument builder for the `PutObjectTagging` S3 API operation. #### SelectObjectContent Argument builder for the `SelectObjectContent` S3 API operation. #### StatObject Argument builder for the `StatObject` S3 API operation. Retrieves all of the metadata from an object without returning the object itself. #### UploadPart Argument for upload_part() S3 API #### UploadPartCopy Argument builder for the `UploadPartCopy` S3 API operation. ``` -------------------------------- ### SseS3 Trait Implementations (Rust) Source: https://docs.rs/minio/latest/minio/s3/sse/struct Details the standard trait implementations for the SseS3 struct, including Clone, Debug, and Default, enabling basic operations like duplication, debugging, and creating default instances. ```rust impl Clone for SseS3 { fn clone(&self) -> SseS3 fn clone_from(&mut self, source: &Self) } impl Debug for SseS3 { fn fmt(&self, f: &mut Formatter<'_>) -> Result } impl Default for SseS3 { fn default() -> Self } ``` -------------------------------- ### SelectObjectContentResponse Source: https://docs.rs/minio/latest/minio/s3/response/struct Represents the response from the select_object_content() API call in MinIO. It contains details about the retrieved object content and associated metadata. ```APIDOC ## Struct SelectObjectContentResponse ### Description Response of the `select_object_content()` API. This structure encapsulates the data returned by MinIO after executing a select query on an object. ### Fields - **headers** (HeaderMap) - HTTP headers returned by the server, containing metadata such as `Content-Type`, `ETag`, etc. - **region** (String) - The AWS region where the bucket resides. - **bucket** (String) - Name of the bucket containing the object. - **object** (String) - Key (path) identifying the object within the bucket. - **progress** (SelectProgress) - Contains information about the progress of the select operation. ### Methods #### pub async fn read(&mut self, buf: &mut [u8]) -> Result Reads the object content into the provided buffer. Returns the number of bytes read. ``` -------------------------------- ### SseS3 Blanket Implementations (Rust) Source: https://docs.rs/minio/latest/minio/s3/sse/struct Showcases blanket implementations applied to SseS3, enabling it to leverage generic functionality provided by other traits. This includes capabilities like type_id, borrow, borrow_mut, and various conversion traits. ```rust impl Any for T where T: 'static + ?Sized impl Borrow for T where T: ?Sized impl BorrowMut for T where T: ?Sized impl CloneToUninit for T where T: Clone impl From for T impl Instrument for T impl Into for T where U: From impl PolicyExt for T where T: ?Sized impl Same for T impl ToOwned for T where T: Clone impl TryFrom for T where U: Into impl TryInto for T where U: TryFrom impl VZip for T where V: MultiLane impl WithSubscriber for T impl ErasedDestructor for T where T: 'static ``` -------------------------------- ### Rust Blanket Implementation: TryFrom for T Source: https://docs.rs/minio/latest/minio/s3/http/struct Shows the generic implementation of the TryFrom trait, enabling fallible conversions between types. This allows for handling potential conversion errors gracefully. ```rust type Error = Infallible ``` ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Configure UploadPart SSE in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Sets the Server-Side Encryption (SSE) configuration for the `UploadPart` request. Accepts an optional `Arc` which likely represents a trait object for different SSE strategies. ```rust pub fn sse(self, sse: Option>) -> Self ``` -------------------------------- ### Minio S3 API Traits Source: https://docs.rs/minio/latest/minio/s3/types/index This section details the traits available for interacting with the S3 API in Minio. ```APIDOC ## Minio S3 API Traits ### FromS3Response Trait for converting HTTP responses into strongly-typed S3 response objects. ### S3Api Trait that defines a common interface for all S3 API request builders. ### ToS3Request Trait for converting a request builder into a concrete S3 HTTP request. ### ToStream ``` -------------------------------- ### Rust Iterator Equality and Comparison Methods Source: https://docs.rs/minio/latest/minio/s3/segmented_bytes/struct Provides methods to compare iterator elements for equality and ordering. These methods consume the iterator and require the elements to implement `PartialEq` or `PartialOrd`. The `eq_by` method allows for custom equality logic but is an unstable nightly-only feature. ```rust fn eq(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialEq<::Item>, Self: Sized, fn ne(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialEq<::Item>, Self: Sized, fn lt(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd<::Item>, Self: Sized, fn le(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd<::Item>, Self: Sized, fn gt(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd<::Item>, Self: Sized, fn ge(self, other: I) -> bool where I: IntoIterator, Self::Item: PartialOrd<::Item>, Self: Sized, ``` ```rust #![feature(iter_order_by)] fn eq_by(self, other: I, eq: F) -> bool where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, ::Item) -> bool, ``` -------------------------------- ### Rust Implementation: Url::clone_from Source: https://docs.rs/minio/latest/minio/s3/http/struct Implements copy-assignment for the Url struct, enabling efficient duplication of Url data. This method is part of the Clone trait's optimization. ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Rust VZip Implementation Source: https://docs.rs/minio/latest/minio/s3/builders/struct Provides an implementation for the `VZip` functionality for types `T` that satisfy the `MultiLane` trait. The `vzip` function is part of this implementation. ```rust impl VZip for T where V: MultiLane ``` ```rust fn vzip(self) -> V ``` -------------------------------- ### Convert GetObjectLockConfig Builder to S3Request (Rust) Source: https://docs.rs/minio/latest/minio/s3/builders/type This method consumes the GetObjectLockConfig request builder and converts it into a generic S3Request object. This is useful for inspecting the request before sending or for other advanced use cases. ```rust fn to_s3request(self) -> Result ``` -------------------------------- ### Rust Implementation: Url::host_header_value Source: https://docs.rs/minio/latest/minio/s3/http/struct Provides a method to generate the appropriate 'Host' header value for an HTTP request based on the Url struct's configuration. This is crucial for correct server communication. ```rust pub fn host_header_value(&self) -> String ``` -------------------------------- ### Convert Multimap to Query String (Rust) Source: https://docs.rs/minio/latest/minio/s3/multimap/type Implements the `to_query_string` function, converting the multimap into a URL-encoded query string format. This is essential for constructing HTTP requests. ```rust fn to_query_string(&self) -> String ``` -------------------------------- ### Implement LifecycleRule::from_xml in Rust Source: https://docs.rs/minio/latest/minio/s3/lifecycle_config/struct Provides a method to create a `LifecycleRule` instance from an XML element. This is useful for deserializing lifecycle configurations stored in XML format. It returns a `Result` which can be either the created `LifecycleRule` or an `Error` if parsing fails. Dependencies include `Element` and `Error` types. ```rust pub fn from_xml(rule_elem: &Element) -> Result ``` -------------------------------- ### Rust Implementation: Url::default Source: https://docs.rs/minio/latest/minio/s3/http/struct Implements the Default trait for the Url struct, providing a default value for a Url. This is useful for initializing Url variables without explicitly setting all fields. ```rust fn default() -> Self ``` -------------------------------- ### Convert Multimap to Signed and Canonical Headers (Rust) Source: https://docs.rs/minio/latest/minio/s3/multimap/type Implements the `get_canonical_headers` function, returning a tuple containing the signed headers and the canonical headers derived from the multimap. This is critical for request authentication. ```rust fn get_canonical_headers(&self) -> (String, String) ``` -------------------------------- ### Convert Multimap to Canonical Query String (Rust) Source: https://docs.rs/minio/latest/minio/s3/multimap/type Implements the `get_canonical_query_string` function, which converts the multimap into a canonical query string. This is often used for consistent signing of requests. ```rust fn get_canonical_query_string(&self) -> String ``` -------------------------------- ### Clone Implementation for UploadPart in Rust Source: https://docs.rs/minio/latest/minio/s3/builders/struct Implements the `Clone` trait for `UploadPart`, allowing the creation of duplicate instances. This is useful for reusing request configurations or performing multiple similar uploads. ```rust fn clone(&self) -> UploadPart ``` ```rust fn clone_from(&mut self, source: &Self) ``` -------------------------------- ### Implement PartialEq for LifecycleRule in Rust Source: https://docs.rs/minio/latest/minio/s3/lifecycle_config/struct Implements the `PartialEq` trait for the `LifecycleRule` struct, enabling equality comparisons between two `LifecycleRule` instances. The `eq` method defines how equality is checked, and `ne` provides the inequality check. This is useful for testing and comparing configurations. ```rust fn eq(&self, other: &LifecycleRule) -> bool fn ne(&self, other: &Rhs) -> bool ``` -------------------------------- ### Implement Debug for ErrorResponse in Rust Source: https://docs.rs/minio/latest/minio/s3/error/struct Shows the implementation of the `Debug` trait for `ErrorResponse`, enabling formatted output for debugging purposes. This is invaluable for inspecting error details during development and troubleshooting. ```rust impl Debug for ErrorResponse { fn fmt(&self, f: &mut Formatter<'_>) -> Result ``` -------------------------------- ### Take Version from Multimap (Rust) Source: https://docs.rs/minio/latest/minio/s3/multimap/type Implements the `take_version` function, which consumes the multimap and returns the associated version string. This operation removes the version from the multimap. ```rust fn take_version(self) -> Option ``` -------------------------------- ### Element Struct and Methods Source: https://docs.rs/minio/latest/minio/s3/utils/xml/struct Details the 'Element' struct and its public methods for XML manipulation, including accessing child elements and text content. ```APIDOC ## Struct Element ### Description Represents an XML element, providing methods to navigate and extract data from an XML structure. ### Methods #### `name(&self) -> &str` Returns the tag name of the XML element. #### `get_child_text(&self, tag: &str) -> Option` Retrieves the text content of the first child element with the specified tag. Returns `None` if the child is not found. #### `get_child_text_or_error(&self, tag: &str) -> Result` Retrieves the text content of the first child element with the specified tag. Returns an `Error` if the child is not found. #### `get_matching_children(&self, tag: &str) -> Vec<(usize, Element<'_>)>` Finds all child elements with the specified tag and returns them as a vector of tuples, where each tuple contains the index and the child element. #### `get_child(&self, tag: &str) -> Option>` Retrieves the first child element with the specified tag. Returns `None` if the child is not found. #### `get_xmltree_children(&self) -> Vec<&Element>` Returns a vector of all direct child elements of the current element. ### Example Usage (Conceptual) ```rust // Assuming 'element' is an instance of Element if let Some(child_text) = element.get_child_text("some_tag") { println!("Child text: {}", child_text); } let children = element.get_xmltree_children(); for child in children { // Process each child element } ``` ``` -------------------------------- ### CompleteMultipartUploadResponse Struct Definition in Rust Source: https://docs.rs/minio/latest/minio/s3/response/type Provides the detailed structure of `CompleteMultipartUploadResponse`, which is aliased to `PutObjectResponse`. It includes fields for HTTP headers, bucket name, object name, region, ETag, and an optional version ID, essential for interpreting the result of a multipart upload. ```rust pub struct CompleteMultipartUploadResponse { pub headers: HeaderMap, pub bucket: String, pub object: String, pub region: String, pub etag: String, pub version_id: Option, } ``` -------------------------------- ### Rust UserIdentity Default Trait Implementation Source: https://docs.rs/minio/latest/minio/s3/types/struct Illustrates the Default trait implementation for UserIdentity, providing a way to create a default instance of the struct. This is useful when an initial or empty user identity is needed. ```Rust impl Default for UserIdentity fn default() -> UserIdentity Returns the “default value” for a type. ``` -------------------------------- ### Rust UserIdentity Clone Trait Implementation Source: https://docs.rs/minio/latest/minio/s3/types/struct Demonstrates the implementation of the Clone trait for the UserIdentity struct, allowing for the creation of duplicate instances. This enables easy copying of user identity information. ```Rust impl Clone for UserIdentity fn clone(&self) -> UserIdentity Performs copy-assignment from `source`. ``` -------------------------------- ### Implement GetObjectLockConfig Builder (Rust) Source: https://docs.rs/minio/latest/minio/s3/builders/type This code snippet shows the implementation of the GetObjectLockConfig struct, which acts as an argument builder for the GetObjectLockConfig S3 API operation. It is part of the minio crate and is used to construct parameters for the Client::get_object_lock_config method. ```rust pub struct GetObjectLockConfig { /* private fields */ } ``` -------------------------------- ### Rust UserIdentity Debug Trait Implementation Source: https://docs.rs/minio/latest/minio/s3/types/struct Shows the Debug trait implementation for UserIdentity, which facilitates formatted output for debugging purposes. This helps in inspecting the state of a UserIdentity object during development. ```Rust impl Debug for UserIdentity fn fmt(&self, f: &mut Formatter<'_>) -> Result Formats the value using the given formatter. ```