Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ macro_rules! as_ref_impl {
($type:ty) => {
#[async_trait]
#[deny(clippy::missing_trait_methods)]
impl ObjectStore for $type {
impl<T: ObjectStore + ?Sized> ObjectStore for $type {
async fn put_opts(
&self,
location: &Path,
Expand Down Expand Up @@ -1146,8 +1146,8 @@ macro_rules! as_ref_impl {
};
}

as_ref_impl!(Arc<dyn ObjectStore>);
as_ref_impl!(Box<dyn ObjectStore>);
as_ref_impl!(Arc<T>);
as_ref_impl!(Box<T>);

/// Extension trait for [`ObjectStore`] with convenience functions.
///
Expand Down Expand Up @@ -1885,9 +1885,8 @@ impl From<Error> for std::io::Error {
#[cfg(test)]
mod tests {
use super::*;
use crate::buffered::BufWriter;

use chrono::TimeZone;
use tokio::io::AsyncWriteExt;

macro_rules! maybe_skip_integration {
() => {
Expand Down Expand Up @@ -1939,6 +1938,9 @@ mod tests {
{
use bytes::Buf;
use serde::Deserialize;
use tokio::io::AsyncWriteExt;

use crate::buffered::BufWriter;

#[derive(Deserialize)]
struct Tagging {
Expand Down Expand Up @@ -2154,4 +2156,23 @@ mod tests {
assert!(options.head);
assert_eq!(options.extensions.get::<&str>(), extensions.get::<&str>());
}

fn takes_generic_object_store<T: ObjectStore>(store: T) {
// This function is just to ensure that the trait bounds are satisfied
let _ = store;
}
#[test]
fn test_dyn_impl() {
let store: Arc<dyn ObjectStore> = Arc::new(memory::InMemory::new());
takes_generic_object_store(store);
let store: Box<dyn ObjectStore> = Box::new(memory::InMemory::new());
takes_generic_object_store(store);
}
#[test]
fn test_generic_impl() {
let store = Arc::new(memory::InMemory::new());
takes_generic_object_store(store);
let store = Box::new(memory::InMemory::new());
takes_generic_object_store(store);
}
}