diff --git a/src/core/matrix_vec.rs b/src/core/matrix_vec.rs index 51a02640..2b5bb372 100644 --- a/src/core/matrix_vec.rs +++ b/src/core/matrix_vec.rs @@ -5,6 +5,9 @@ use core::dimension::{Dim, DimName, Dynamic, U1}; use core::storage::{Storage, StorageMut, Owned, OwnedStorage}; use core::default_allocator::DefaultAllocator; +#[cfg(feature = "abomonation-serialize")] +use abomonation::Abomonation; + /* * * Storage. @@ -171,3 +174,18 @@ unsafe impl OwnedStorage for MatrixVec Abomonation for MatrixVec { + unsafe fn entomb(&self, writer: &mut Vec) { + self.data.entomb(writer) + } + + unsafe fn embalm(&mut self) { + self.data.embalm() + } + + unsafe fn exhume<'a, 'b>(&'a mut self, bytes: &'b mut [u8]) -> Option<&'b mut [u8]> { + self.data.exhume(bytes) + } +} diff --git a/tests/abomonation.rs b/tests/abomonation.rs index 1da6ba3c..1fd694cd 100644 --- a/tests/abomonation.rs +++ b/tests/abomonation.rs @@ -4,7 +4,7 @@ extern crate abomonation; use rand::random; use abomonation::{Abomonation, encode, decode}; -use nalgebra::{Matrix3x4, Point3}; +use nalgebra::{DMatrix, Matrix3x4, Point3}; #[test] fn abomonate_matrix3x4() { @@ -16,6 +16,11 @@ fn abomonate_point3() { assert_encode_and_decode(&random::>()); } +#[test] +fn abomonate_dmatrix() { + assert_encode_and_decode(&DMatrix::::new_random(3, 5)); +} + fn assert_encode_and_decode(data: &T) { let mut bytes = Vec::new(); unsafe { encode(data, &mut bytes); }