pub struct Body<'a> { /* private fields */ }Expand description
A document body: the bytes between a heading and EOT, or the inside of a nested level. Everything it returns borrows the original buffer.
Records before the first GS of a file form an unnamed group; records and groups before the first FS form an unnamed file.
Implementations§
Source§impl<'a> Body<'a>
impl<'a> Body<'a>
Sourcepub fn slice(buf: &'a [u8], start: usize, stop: usize) -> Result<Self>
pub fn slice(buf: &'a [u8], start: usize, stop: usize) -> Result<Self>
Parse buf[start..stop] as a body.
Sourcepub fn of_level(raw: &'a [u8]) -> Result<Self>
pub fn of_level(raw: &'a [u8]) -> Result<Self>
The contents of a nested level: raw is a unit holding DLE … CAN
(layout at its edges allowed).
Sourcepub fn files(&self) -> &[FileView<'a>]
pub fn files(&self) -> &[FileView<'a>]
The files of the body, in order. There is always at least one (the unnamed file, when the body has no FS).
Sourcepub fn groups(&self) -> impl Iterator<Item = &Group<'a>> + '_
pub fn groups(&self) -> impl Iterator<Item = &Group<'a>> + '_
All groups of all files, in order.
Sourcepub fn group_count(&self) -> usize
pub fn group_count(&self) -> usize
Groups of the first file.
Sourcepub fn group_by_name(&self, name: &str) -> Result<&Group<'a>>
pub fn group_by_name(&self, name: &str) -> Result<&Group<'a>>
The first file’s group named name.
Sourcepub fn group_names(&self) -> Vec<&'a [u8]>
pub fn group_names(&self) -> Vec<&'a [u8]>
Names of the first file’s groups.
Sourcepub fn records(&self) -> &[Record<'a>]
pub fn records(&self) -> &[Record<'a>]
Records of the body when it is a bare record stream (no FS, no GS): the unnamed group’s records.
pub fn record_count(&self) -> usize
pub fn record(&self, i: usize) -> Record<'a>
Auto Trait Implementations§
impl<'a> Forget for Body<'a>
impl<'a> Freeze for Body<'a>
impl<'a> Move for Body<'a>
impl<'a> RefUnwindSafe for Body<'a>
impl<'a> Send for Body<'a>
impl<'a> Sync for Body<'a>
impl<'a> Unpin for Body<'a>
impl<'a> UnsafeUnpin for Body<'a>
impl<'a> UnwindSafe for Body<'a>
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