Struct pica_record::primitives::Field
source · pub struct Field { /* private fields */ }
Expand description
A mutable field.
Implementations§
source§impl Field
impl Field
sourcepub fn new<'a, T>(
tag: &str,
occ: Option<&str>,
subfields: T,
) -> Result<Self, ParsePicaError>
pub fn new<'a, T>( tag: &str, occ: Option<&str>, subfields: T, ) -> Result<Self, ParsePicaError>
sourcepub fn write_to(&self, out: &mut impl Write) -> Result<()>
pub fn write_to(&self, out: &mut impl Write) -> Result<()>
Write the Field into the given writer.
§Example
use std::io::Cursor;
use pica_record::primitives::Field;
let mut writer = Cursor::new(Vec::<u8>::new());
let field =
Field::new("012A", Some("01"), vec![('a', "b"), ('c', "d")])?;
field.write_to(&mut writer);
assert_eq!(
String::from_utf8(writer.into_inner())?,
"012A/01 \x1fab\x1fcd\x1e"
);
Trait Implementations§
impl Eq for Field
impl StructuralPartialEq for Field
Auto Trait Implementations§
impl Freeze for Field
impl RefUnwindSafe for Field
impl Send for Field
impl Sync for Field
impl Unpin for Field
impl UnwindSafe for Field
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)