Struct MemoryHandle
pub struct MemoryHandle(/* private fields */);Expand description
One handle onto a MemoryFixture’s store.
§Why a newtype rather than impl EventStore for Arc<S>
“Just add a blanket impl<S: EventStore> EventStore for Arc<S>” is the first
thing anyone tries, and it is very likely error[E0119] in
happenstance-core: trait_variant already emits a blanket
impl<T: SendEventStore> EventStore for T, and coherence cannot rule out
that some downstream Arc<S> implements SendEventStore — proving it does
not would need negative reasoning the trait solver does not have. So the
shared handle has to be a distinct type that delegates, and delegating by
hand is the price of the shape.
It implements SendEventStore, not merely
EventStore: MemoryEventStore is a
native, thread-safe store, and a handle that quietly weakened that would stop
exercising the flavour the reference implementation actually claims.
Trait Implementations§
§impl Clone for MemoryHandle
impl Clone for MemoryHandle
§impl Debug for MemoryHandle
impl Debug for MemoryHandle
§impl SendEventStore for MemoryHandle
impl SendEventStore for MemoryHandle
§type Error = <MemoryEventStore as SendEventStore>::Error
type Error = <MemoryEventStore as SendEventStore>::Error
§fn read(
&self,
query: &Query,
options: ReadOptions,
) -> impl Stream<Item = Result<SequencedEvent, Self::Error>> + Send
fn read( &self, query: &Query, options: ReadOptions, ) -> impl Stream<Item = Result<SequencedEvent, Self::Error>> + Send
§async fn append(
&self,
events: &[Event],
condition: Option<&AppendCondition>,
) -> Result<SequencePosition, AppendError<Self::Error>>
async fn append( &self, events: &[Event], condition: Option<&AppendCondition>, ) -> Result<SequencePosition, AppendError<Self::Error>>
Auto Trait Implementations§
impl Freeze for MemoryHandle
impl RefUnwindSafe for MemoryHandle
impl Send for MemoryHandle
impl Sync for MemoryHandle
impl Unpin for MemoryHandle
impl UnsafeUnpin for MemoryHandle
impl UnwindSafe for MemoryHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<TraitVariantBlanketType> EventStore for TraitVariantBlanketTypewhere
TraitVariantBlanketType: SendEventStore,
impl<TraitVariantBlanketType> EventStore for TraitVariantBlanketTypewhere
TraitVariantBlanketType: SendEventStore,
Source§type Error = <TraitVariantBlanketType as SendEventStore>::Error
type Error = <TraitVariantBlanketType as SendEventStore>::Error
Source§fn read(
&self,
query: &Query,
options: ReadOptions,
) -> impl Stream<Item = Result<SequencedEvent, <TraitVariantBlanketType as EventStore>::Error>>
fn read( &self, query: &Query, options: ReadOptions, ) -> impl Stream<Item = Result<SequencedEvent, <TraitVariantBlanketType as EventStore>::Error>>
Source§async fn append(
&self,
events: &[Event],
condition: Option<&AppendCondition>,
) -> Result<SequencePosition, AppendError<<TraitVariantBlanketType as EventStore>::Error>>
async fn append( &self, events: &[Event], condition: Option<&AppendCondition>, ) -> Result<SequencePosition, AppendError<<TraitVariantBlanketType as EventStore>::Error>>
Source§async fn head(
&self,
) -> Result<Option<SequencePosition>, <TraitVariantBlanketType as EventStore>::Error>
async fn head( &self, ) -> Result<Option<SequencePosition>, <TraitVariantBlanketType as EventStore>::Error>
None when it
holds nothing. Read moreSource§async fn contains_event_id(
&self,
id: EventId,
) -> Result<bool, <TraitVariantBlanketType as EventStore>::Error>
async fn contains_event_id( &self, id: EventId, ) -> Result<bool, <TraitVariantBlanketType as EventStore>::Error>
id. Read more