pub struct ObservationState { /* private fields */ }Expand description
Cursor and lifecycle tracker; typed consumers own staged view data.
Implementations§
Source§impl ObservationState
impl ObservationState
Sourcepub async fn apply<E, F, Fut>(
&mut self,
frame: &StreamFrame,
has_payload: bool,
reducer: F,
) -> Result<ObservationAction, ObservationApplyError<E>>
pub async fn apply<E, F, Fut>( &mut self, frame: &StreamFrame, has_payload: bool, reducer: F, ) -> Result<ObservationAction, ObservationApplyError<E>>
Advances this tracker only after the view reducer succeeds. At Commit, the reducer must atomically apply staged data and persist the supplied cursor. A failed reducer leaves the tracker at its previous checkpoint.
pub fn new(binding_digest: [u8; 32], cursor: Vec<u8>) -> Self
pub fn cursor(&self) -> &[u8] ⓘ
pub fn is_complete(&self) -> bool
Sourcepub fn accept(
&mut self,
frame: &StreamFrame,
has_payload: bool,
) -> Result<ObservationAction, StreamProtocolError>
pub fn accept( &mut self, frame: &StreamFrame, has_payload: bool, ) -> Result<ObservationAction, StreamProtocolError>
Validate a frame before changing lifecycle state. A rejected frame leaves the state unchanged. Transport adapters enforce negotiated byte budgets before decoding; callers validate the method-specific typed payload.
For reducers that can fail, run this on a clone, apply the returned action, then replace the original tracker only if the reducer succeeds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ObservationState
impl RefUnwindSafe for ObservationState
impl Send for ObservationState
impl Sync for ObservationState
impl Unpin for ObservationState
impl UnsafeUnpin for ObservationState
impl UnwindSafe for ObservationState
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