pub struct WkbCapacity { /* private fields */ }
Expand description
A counter for the buffer sizes of a GenericWkbArray
.
This can be used to reduce allocations by allocating once for exactly the array size you need.
Implementations§
Source§impl WkbCapacity
impl WkbCapacity
Sourcepub fn new(buffer_capacity: usize, offsets_capacity: usize) -> Self
pub fn new(buffer_capacity: usize, offsets_capacity: usize) -> Self
Create a new capacity with known sizes.
Sourcepub fn buffer_capacity(&self) -> usize
pub fn buffer_capacity(&self) -> usize
The capacity of the underlying data buffer
Sourcepub fn offsets_capacity(&self) -> usize
pub fn offsets_capacity(&self) -> usize
The capacity of the underlying offsets buffer
Sourcepub fn add_geometry<'a>(
&mut self,
geom: Option<&'a (impl GeometryTrait<T = f64> + 'a)>,
)
pub fn add_geometry<'a>( &mut self, geom: Option<&'a (impl GeometryTrait<T = f64> + 'a)>, )
Add a Geometry to this capacity counter.
Sourcepub fn from_geometries<'a>(
geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>,
) -> Self
pub fn from_geometries<'a>( geoms: impl Iterator<Item = Option<&'a (impl GeometryTrait<T = f64> + 'a)>>, ) -> Self
Create a capacity counter from an iterator of Geometries.
Sourcepub fn num_bytes<O: OffsetSizeTrait>(&self) -> usize
pub fn num_bytes<O: OffsetSizeTrait>(&self) -> usize
The number of bytes an array with this capacity would occupy.
Trait Implementations§
Source§impl Add for WkbCapacity
impl Add for WkbCapacity
Source§impl Clone for WkbCapacity
impl Clone for WkbCapacity
Source§fn clone(&self) -> WkbCapacity
fn clone(&self) -> WkbCapacity
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WkbCapacity
impl Debug for WkbCapacity
Source§impl Default for WkbCapacity
impl Default for WkbCapacity
impl Copy for WkbCapacity
Auto Trait Implementations§
impl Freeze for WkbCapacity
impl RefUnwindSafe for WkbCapacity
impl Send for WkbCapacity
impl Sync for WkbCapacity
impl Unpin for WkbCapacity
impl UnwindSafe for WkbCapacity
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more