Skip to content

Commit

Permalink
implement Default trait for AmanzonS3Builder
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorgan committed Dec 25, 2024
1 parent 1a2758c commit d9c2049
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions integrations/object_store/examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ use std::sync::Arc;
use bytes::Bytes;
use object_store::path::Path;
use object_store::ObjectStore;

#[cfg(feature = "services-s3")]
use object_store_opendal::AmazonS3Builder;

#[cfg(feature = "services-s3")]
#[tokio::main]
async fn main() {
let s3_store = AmazonS3Builder::new()
Expand Down Expand Up @@ -33,3 +36,8 @@ async fn main() {

assert_eq!(content, bytes);
}

#[cfg(not(feature = "services-s3"))]
fn main() {
println!("The 'services-s3' feature is not enabled.");
}
6 changes: 6 additions & 0 deletions integrations/object_store/src/s3_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ pub struct AmazonS3Builder {
builder: S3,
}

impl Default for AmazonS3Builder {
fn default() -> Self {
Self::new()
}
}

impl AmazonS3Builder {
pub fn new() -> Self {
AmazonS3Builder {
Expand Down

0 comments on commit d9c2049

Please sign in to comment.