pub struct Data<T> { /* private fields */ }Expand description
A cloneable, type-erased handle to a Dataset.
Implementations§
Source§impl<T: Send + 'static> Data<T>
impl<T: Send + 'static> Data<T>
Sourcepub async fn write_all(&self, items: impl IntoIterator<Item = T>) -> Result<()>
pub async fn write_all(&self, items: impl IntoIterator<Item = T>) -> Result<()>
Stores every item of items, stopping at the first error.
§Errors
Returns an error if the underlying dataset fails.
Sourcepub async fn read(&self) -> Result<Option<T>>
pub async fn read(&self) -> Result<Option<T>>
Takes the next item, or None if the dataset is empty.
§Errors
Returns an error if the underlying dataset fails.
Sourcepub async fn read_all(&self) -> Result<Vec<T>>
pub async fn read_all(&self) -> Result<Vec<T>>
Takes every item until the dataset is empty.
§Errors
Returns an error if the underlying dataset fails.
Sourcepub fn into_stream(self) -> impl Stream<Item = Result<T>> + Send
pub fn into_stream(self) -> impl Stream<Item = Result<T>> + Send
Returns a stream that takes items until the dataset is empty.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Data<T>
impl<T> !UnwindSafe for Data<T>
impl<T> Freeze for Data<T>
impl<T> Send for Data<T>
impl<T> Sync for Data<T>
impl<T> Unpin for Data<T>
impl<T> UnsafeUnpin for Data<T>where
Arc<dyn DynDataset<T>>: UnsafeUnpin,
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