pub struct Buf2D<T> { /* private fields */ }
Expand description
A two dimensional vector.
This type is mainly meant to be used as the return value of build
.
use prefix_sum::sum2d::Buf2D;
let mut buf2d = Buf2D::new(2, 2, 0i32);
buf2d[(0,0)] = 1;
buf2d[(1,0)] = 2;
buf2d[(0,1)] = 3;
buf2d[(1,1)] = 4;
assert_eq!(buf2d.into_vec(), vec![1, 2, 3, 4]);
Creates a new Buf2D
with the specified size and a clone of init
in every spot.
This is O(width*height)
.
Create a Buf2D
with the given data.
This is a constant time operation.
Panics if vec.len()
is not a multiple of width
.
Returns a vector where (x,y)
is stored at y*width + x
.
This is a constant time operation.
Return the width of the Buf2D
.
This is a constant time operation.
Return the height of the Buf2D
.
This is a constant time operation.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Access the item at (x,y)
in the buffer.
This is a constant time operation.
The returned type after indexing.
Modify the item at (x,y)
in the buffer.
This is a constant time operation.
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
This method tests for
self
and
other
values to be equal, and is used
by
==
.
Read more
This method tests for
!=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
Read more
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.