diff --git a/README.md b/README.md index 42c99cb..430421d 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,11 @@ let data : Vec = var.values().unwrap(); for x in 0..(6*12) { assert_eq!(data[x], x as i32); } + +// You can also fetch a single value from a datasets, +// using a array slice to index it +let first_val: i32 = var.value_at(&[5, 3]).unwrap(); + ``` ## Write Example diff --git a/tests/lib.rs b/tests/lib.rs index 4a52a30..f32fab0 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -76,7 +76,7 @@ fn test_index_fetch() { let var = file.root.variables.get("data").unwrap(); let first_val: i32 = var.value_at(&[0usize, 0usize]).unwrap(); - let other_val: i32 = var.value_at(&[5usize, 3usize]).unwrap(); + let other_val: i32 = var.value_at(&[5, 3]).unwrap(); assert_eq!(first_val, 0 as i32); assert_eq!(other_val, 63 as i32 );