pub struct Builder { /* private fields */ }Expand description
A builder for a Section.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn push_data(self, record: Record) -> Self
pub fn push_data(self, record: Record) -> Self
Pushes a data record into the
Builder.
§Examples
use chainfile::alignment::section::Builder;
use chainfile::alignment::section::data::Record;
let data = "10".parse::<Record>()?;
let builder = Builder::default().push_data(data);
Sourcepub fn try_build(self) -> Result<Section, Error>
pub fn try_build(self) -> Result<Section, Error>
Consumes self to attempt to build a Section.
§Examples
use chainfile::alignment::section::Builder;
use chainfile::alignment::section::data;
use chainfile::alignment::section::header;
let mut section = Builder::default()
.header("chain 0 seq0 2 + 0 2 seq0 2 - 0 2 1".parse()?)?
.push_data("3\t0\t1".parse()?)
.push_data("1".parse()?)
.try_build()?;
assert_eq!(section.header().score(), 0);
assert_eq!(section.header().id(), 1);
assert_eq!(section.data().len(), 2);
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
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