pub struct PyExternalObjectStore(/* private fields */);
Expand description
A wrapper around a Rust ObjectStore instance that will extract and recreate an ObjectStore instance out of a Python object.
This will accept ObjectStore instances from any Python library exporting store classes
from pyo3-object_store
.
§Caveats
-
This will extract the configuration of the store and recreate the store instance in the current module. This means that no connection pooling will be reused from the original library. Also, there is a slight overhead to this as configuration parsing will need to happen from scratch.
This will work best when the store is created once and used multiple times.
-
This relies on the public Python API (
__getnewargs_ex__
and__init__
) of the store classes to extract the configuration. If the public API changes in a non-backwards compatible way, this store conversion may fail. -
While this reuses
__getnewargs_ex__
(from the pickle implementation) to extract arguments to pass into__init__
, it does not actually use pickle, and so even non-pickleable credential providers should work. -
This will not work for
PyMemoryStore
because we can’t clone the internal state of the store.
Implementations§
Source§impl PyExternalObjectStore
impl PyExternalObjectStore
Sourcepub fn into_dyn(self) -> Arc<dyn ObjectStore>
pub fn into_dyn(self) -> Arc<dyn ObjectStore>
Consume self and return a reference-counted ObjectStore
.
Trait Implementations§
Source§impl Clone for PyExternalObjectStore
impl Clone for PyExternalObjectStore
Source§fn clone(&self) -> PyExternalObjectStore
fn clone(&self) -> PyExternalObjectStore
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PyExternalObjectStore
impl Debug for PyExternalObjectStore
Source§impl From<PyExternalObjectStore> for Arc<dyn ObjectStore>
impl From<PyExternalObjectStore> for Arc<dyn ObjectStore>
Source§fn from(value: PyExternalObjectStore) -> Self
fn from(value: PyExternalObjectStore) -> Self
Source§impl<'py> FromPyObject<'py> for PyExternalObjectStore
impl<'py> FromPyObject<'py> for PyExternalObjectStore
Auto Trait Implementations§
impl Freeze for PyExternalObjectStore
impl !RefUnwindSafe for PyExternalObjectStore
impl Send for PyExternalObjectStore
impl Sync for PyExternalObjectStore
impl Unpin for PyExternalObjectStore
impl !UnwindSafe for PyExternalObjectStore
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more