vortex_array/nbytes.rs
1use crate::{Array, ArrayVisitorExt};
2
3pub trait NBytes: Array {
4 /// Total size of the array in bytes, including all children and buffers.
5 // TODO(ngates): this should return u64
6 fn nbytes(&self) -> usize {
7 let mut nbytes = 0;
8 for array in self.depth_first_traversal() {
9 for buffer in array.buffers() {
10 nbytes += buffer.len();
11 }
12 }
13 nbytes
14 }
15}
16
17impl<T: Array + ?Sized> NBytes for T {}