Merge branch 'feat/p1-wasm' into feat/p1-proof

# Conflicts:
#	Cargo.toml
#	scripts/ci-test.sh
This commit is contained in:
osobh
2026-09-26 01:38:17 -05:00
22 changed files with 2253 additions and 5 deletions
+29
View File
@@ -144,6 +144,35 @@ mod tests {
assert_eq!(ds.dtype().unwrap(), DType::I32);
}
#[test]
fn dataset_raw_datatype() {
use clawhdf5_format::datatype::Datatype;
let bytes = make_simple_file();
let file = File::from_bytes(bytes).unwrap();
let dt = file.dataset("counts").unwrap().raw_datatype().unwrap();
assert!(
matches!(
dt,
Datatype::FixedPoint {
size: 4,
signed: true,
..
}
),
"{dt:?}"
);
// The full type pairs with read_selection's bytes.
let raw = file
.dataset("counts")
.unwrap()
.read_selection(&Selection::All)
.unwrap();
assert_eq!(
clawhdf5_format::data_read::read_as_i64(&raw, &dt).unwrap(),
vec![10, 20, 30]
);
}
#[test]
fn root_group_datasets() {
let bytes = make_simple_file();
+9
View File
@@ -424,6 +424,15 @@ impl<'f> Dataset<'f> {
Ok(classify_datatype(&dt))
}
/// Returns the dataset's full datatype as stored in the file (byte order,
/// string padding, compound layout, ...), with a committed datatype
/// resolved. Use it with the `clawhdf5_format::data_read` converters on
/// the bytes [`read_selection`](Self::read_selection) returns, for types
/// the typed `read_*` methods do not cover.
pub fn raw_datatype(&self) -> Result<Datatype, Error> {
self.datatype()
}
/// Read all data as `f64` values.
pub fn read_f64(&self) -> Result<Vec<f64>, Error> {
let dt = self.datatype()?;