Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/src/frame/plane.rs b/src/frame/plane.rs
index 71555c42..30f0c020 100644
--- a/src/frame/plane.rs
+++ b/src/frame/plane.rs
@@ -665,6 +665,39 @@ pub mod test {
assert_eq!(&input[..64], &plane.data[..64]);
}
+ #[test]
+ fn mutable_access() {
+ let mut plane = Plane::<u8> {
+ data: PlaneData::from_slice(&vec![
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 2, 3, 4, 0, 0,
+ 0, 0, 8, 7, 6, 5, 0, 0,
+ 0, 0, 9, 8, 7, 6, 0, 0,
+ 0, 0, 2, 3, 4, 5, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+ ]),
+ cfg: PlaneConfig {
+ stride: 8,
+ alloc_height: 9,
+ width: 4,
+ height: 4,
+ xdec: 0,
+ ydec: 0,
+ xpad: 0,
+ ypad: 0,
+ xorigin: 2,
+ yorigin: 3,
+ },
+ };
+ let mut s = plane.as_mut_slice();
+
+ s[1][2] = 42;
+
+ }
+
#[test]
fn test_plane_pad() {
let mut plane = Plane::<u8> {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.