Struct qwt::qvector::QVectorBuilder
source · pub struct QVectorBuilder { /* private fields */ }
Expand description
Builder struct to build a qvector
by pushing symbol by symbol.
The main reasons for this builder are
- we want to force
qvector
to be immutable. So, we don’t want any method that could change it; - we want to save space when symbols are produced one after the other and store them using 2 bits each.
Implementations§
source§impl QVectorBuilder
impl QVectorBuilder
sourcepub fn with_capacity(n: usize) -> Self
pub fn with_capacity(n: usize) -> Self
Creates an empty dynamic quad vector with the capacity of n
quad symbols.
§Panics
Panics if the new capacity exceeds isize::MAX
bytes.
sourcepub fn push(&mut self, symbol: u8)
pub fn push(&mut self, symbol: u8)
Appends the (last 2 bits of the) value symbol
at the end
of the quad vector.
It does not check if the value symbol
fits is actually in [0..3].
The value is truncated to the two least significant bits.
§Panics
Panics if the new capacity exceeds isize::MAX
bytes.
Trait Implementations§
source§impl Clone for QVectorBuilder
impl Clone for QVectorBuilder
source§fn clone(&self) -> QVectorBuilder
fn clone(&self) -> QVectorBuilder
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 Default for QVectorBuilder
impl Default for QVectorBuilder
source§fn default() -> QVectorBuilder
fn default() -> QVectorBuilder
Returns the “default value” for a type. Read more
source§impl<T> Extend<T> for QVectorBuilder
impl<T> Extend<T> for QVectorBuilder
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
source§impl<T> FromIterator<T> for QVectorBuilder
impl<T> FromIterator<T> for QVectorBuilder
source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = T>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = T>,
Creates a value from an iterator. Read more
source§impl PartialEq for QVectorBuilder
impl PartialEq for QVectorBuilder
source§fn eq(&self, other: &QVectorBuilder) -> bool
fn eq(&self, other: &QVectorBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl Eq for QVectorBuilder
impl StructuralPartialEq for QVectorBuilder
Auto Trait Implementations§
impl Freeze for QVectorBuilder
impl RefUnwindSafe for QVectorBuilder
impl Send for QVectorBuilder
impl Sync for QVectorBuilder
impl Unpin for QVectorBuilder
impl UnwindSafe for QVectorBuilder
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)