Dataset length
All checks were successful
CI / Typos (push) Successful in 32s
CI / Clippy (push) Successful in 1m25s
CI / Build and test (all features) (push) Successful in 5m12s
CI / Build and test (push) Successful in 6m13s

This commit is contained in:
2026-03-23 14:12:11 -07:00
parent 4737acbcf4
commit 4010d3cc1c
4 changed files with 18 additions and 0 deletions

View File

@@ -112,6 +112,10 @@ impl DirDataSource {
}
impl DataSource for Arc<DirDataSource> {
fn len(&self) -> usize {
self.index.get().expect("index should be initialized").len()
}
#[expect(clippy::expect_used)]
async fn get(&self, key: &str) -> Result<Option<Item>, std::io::Error> {
return Ok(self

View File

@@ -8,6 +8,9 @@ pub mod misc;
/// A read-only set of [Item]s.
pub trait DataSource {
/// Get the number of items in this source
fn len(&self) -> usize;
/// Get an item from this datasource
fn get(
&self,

View File

@@ -163,6 +163,10 @@ impl S3DataSource {
}
impl DataSource for Arc<S3DataSource> {
fn len(&self) -> usize {
self.index.get().expect("index should be initialized").len()
}
#[expect(clippy::expect_used)]
async fn get(&self, key: &str) -> Result<Option<Item>, std::io::Error> {
return Ok(self