Struct SqliteReadStream
pub struct SqliteReadStream { /* private fields */ }Available on crate feature
event-store only.Expand description
The stream SqliteEventStore::read returns.
§Why this type is Send
Nothing here is Send by accident, and each piece earns it separately:
- the cursor holds
Arc<Mutex<Connection>>, andMutex<T>: SyncwheneverT: Send— so wrapping the!Sync[Connection] is what makes the whole cursorSend; - [
JoinHandle<T>] isSendwhenTis, andThere is the cursor plus aResult<Page, SqliteEventStoreError>, whose error wrapsrusqlite::Error(Send+Sync) and [JoinError]; - the drain state holds
vec::IntoIter<SequencedEvent>,SendbecauseSequencedEventis.
No rusqlite handle that borrows the connection — Statement, Rows,
Transaction — ever appears in a field, and that is the load-bearing part:
all three are !Send, so holding one across the poll_next boundary would
cost the stream its Send-ness and with it the SendEventStore impl.
Confining them to the inside of the blocking closure is not a style choice.
The type is also Unpin — every field is — so poll_next needs no pin
projection and no unsafe, which matters because unsafe_code is
forbidden workspace-wide.
Trait Implementations§
§impl Debug for SqliteReadStream
impl Debug for SqliteReadStream
§impl Stream for SqliteReadStream
impl Stream for SqliteReadStream
§type Item = Result<SequencedEvent, SqliteEventStoreError>
type Item = Result<SequencedEvent, SqliteEventStoreError>
Values yielded by the stream.
Auto Trait Implementations§
impl Freeze for SqliteReadStream
impl RefUnwindSafe for SqliteReadStream
impl Send for SqliteReadStream
impl Sync for SqliteReadStream
impl Unpin for SqliteReadStream
impl UnsafeUnpin for SqliteReadStream
impl UnwindSafe for SqliteReadStream
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
Mutably borrows from an owned value. Read more