alamb commented on code in PR #848:
URL:
https://github.com/apache/arrow-rs-object-store/pull/848#discussion_r3874913414
##########
src/lib.rs:
##########
@@ -801,6 +801,31 @@ pub type MultipartId = String;
/// If a store implements [`Clone`], that will only clone the handle to the
underlying data. It will NOT clone/fork the
/// actual key-value data. Hence, the cloned instance and the original
instance share the same state.
///
+/// # Downcasting
+/// [`Any`] is a supertrait of [`ObjectStore`] so that users can recover the
concrete
+/// store behind a `dyn ObjectStore`. This requires nothing from implementors:
the
Review Comment:
I think we can probably remove the " This requires nothing from
implementors: the" sentenece -- or at least make it easier to udnerstand ("most
users should not have to do anything special...")
##########
src/lib.rs:
##########
@@ -801,6 +801,31 @@ pub type MultipartId = String;
/// If a store implements [`Clone`], that will only clone the handle to the
underlying data. It will NOT clone/fork the
/// actual key-value data. Hence, the cloned instance and the original
instance share the same state.
///
+/// # Downcasting
+/// [`Any`] is a supertrait of [`ObjectStore`] so that users can recover the
concrete
+/// store behind a `dyn ObjectStore`. This requires nothing from implementors:
the
+/// trait already requires `'static`, and [`Any`] is blanket implemented for
every
+/// `'static` type.
+///
+/// ```
+/// # use std::any::TypeId;
+/// # use std::sync::Arc;
+/// # use object_store::{ObjectStore, memory::InMemory};
+/// let store: Arc<dyn ObjectStore> = Arc::new(InMemory::new());
+/// assert_eq!(store.as_ref().type_id(), TypeId::of::<InMemory>());
Review Comment:
can we use `downcast::<InMemory>().unwrap()` perhaps rather than checking
the type id? That would show how to get backa concrete pointer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]