pub struct BinaryContainer { /* private fields */ }Expand description
Container for binary-format records.
Used for PCB files where records are size-prefixed binary blocks.
Implementations§
Source§impl BinaryContainer
impl BinaryContainer
Sourcepub fn from_blocks(source: &str, blocks: &[Block]) -> Self
pub fn from_blocks(source: &str, blocks: &[Block]) -> Self
Creates a container from raw binary blocks.
Each block is expected to have object_id as the first byte.
Sourcepub fn get(&self, index: usize) -> Option<&BinaryRecord>
pub fn get(&self, index: usize) -> Option<&BinaryRecord>
Gets a record by index.
Sourcepub fn get_mut(&mut self, index: usize) -> Option<&mut BinaryRecord>
pub fn get_mut(&mut self, index: usize) -> Option<&mut BinaryRecord>
Gets a mutable record by index.
Sourcepub fn iter(&self) -> impl Iterator<Item = &BinaryRecord>
pub fn iter(&self) -> impl Iterator<Item = &BinaryRecord>
Iterates over all records.
Sourcepub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BinaryRecord>
pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut BinaryRecord>
Iterates mutably over all records.
Sourcepub fn filter_by_type(
&self,
object_id: PcbObjectId,
) -> impl Iterator<Item = &BinaryRecord>
pub fn filter_by_type( &self, object_id: PcbObjectId, ) -> impl Iterator<Item = &BinaryRecord>
Filters records by object ID.
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Returns true if any records were modified.
Sourcepub fn push(&mut self, record: BinaryRecord)
pub fn push(&mut self, record: BinaryRecord)
Adds a record to the container.
Sourcepub fn remove(&mut self, index: usize) -> Option<BinaryRecord>
pub fn remove(&mut self, index: usize) -> Option<BinaryRecord>
Removes a record by index.
Trait Implementations§
Source§impl Clone for BinaryContainer
impl Clone for BinaryContainer
Source§fn clone(&self) -> BinaryContainer
fn clone(&self) -> BinaryContainer
Returns a duplicate 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 BinaryContainer
impl Debug for BinaryContainer
Source§impl<'a> IntoIterator for &'a BinaryContainer
impl<'a> IntoIterator for &'a BinaryContainer
Source§impl IntoIterator for BinaryContainer
impl IntoIterator for BinaryContainer
Auto Trait Implementations§
impl Freeze for BinaryContainer
impl RefUnwindSafe for BinaryContainer
impl Send for BinaryContainer
impl Sync for BinaryContainer
impl Unpin for BinaryContainer
impl UnwindSafe for BinaryContainer
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§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more