pub struct StaticSource { /* private fields */ }Expand description
In-memory SyncSource used by tests.
Holds a list of pre-baked PullResult batches and serves them in order;
once exhausted, subsequent calls return an empty batch with has_more = false.
Implementations§
Source§impl StaticSource
impl StaticSource
Sourcepub fn new(id: impl Into<String>, batches: Vec<PullResult>) -> Self
pub fn new(id: impl Into<String>, batches: Vec<PullResult>) -> Self
Build a static source with the given id and batches.
Sourcepub fn from_deltas(id: impl Into<String>, deltas: Vec<Delta>) -> Self
pub fn from_deltas(id: impl Into<String>, deltas: Vec<Delta>) -> Self
Convenience: build a single-batch source from a flat delta list.
Sourcepub fn enqueue(&self, batch: PullResult)
pub fn enqueue(&self, batch: PullResult)
Push another batch to be served on the next pull.
Trait Implementations§
Source§impl SyncSource for StaticSource
impl SyncSource for StaticSource
Source§fn pull<'life0, 'async_trait>(
&'life0 self,
_cursor: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<PullResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn pull<'life0, 'async_trait>(
&'life0 self,
_cursor: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<PullResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Pull the next batch of deltas.
cursor is the value the source
returned from the previous call, or None for the first pull.Auto Trait Implementations§
impl !Freeze for StaticSource
impl RefUnwindSafe for StaticSource
impl Send for StaticSource
impl Sync for StaticSource
impl Unpin for StaticSource
impl UnsafeUnpin for StaticSource
impl UnwindSafe for StaticSource
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
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>
Converts
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>
Converts
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