pub struct LinePart {
pub blockp: BlockP,
pub blocki_beg: BlockIndex,
pub blocki_end: BlockIndex,
pub blocksz: BlockSz,
/* private fields */
}
Expand description
A LinePart
is some or all of a Line
within a Block
.
The purpose of a LinePart
is to help track a slice into a Block
.
A Line
can span more than one Block
. A LinePart
tracks the line data
residing in one Block
. One LinePart
to one Block
.
One or more LinePart
s are required for a Line
.
A LinePart
is essentially a slice with some extra “bells & whistles”.
Fields§
§blockp: BlockP
The Block
pointer.
blocki_beg: BlockIndex
Index into the blockp
, index at beginning used as-is in slice notation
(inclusive).
blocki_end: BlockIndex
Index into the blockp
, index at one after ending '\n'
(may refer to one past end of Block
) used as-is in slice notation
(exclusive).
blocksz: BlockSz
The file-designated BlockSz
, not necessarily the len()
of the
Block
at blockp
.
Implementations§
source§impl LinePart
impl LinePart
sourcepub fn new(
blockp: BlockP,
blocki_beg: BlockIndex,
blocki_end: BlockIndex,
fileoffset: FileOffset,
blockoffset: BlockOffset,
blocksz: BlockSz
) -> LinePart
pub fn new( blockp: BlockP, blocki_beg: BlockIndex, blocki_end: BlockIndex, fileoffset: FileOffset, blockoffset: BlockOffset, blocksz: BlockSz ) -> LinePart
Create a new LinePart
.
Remember that blocki_end
points to one byte past
because it used directly in byte array slice notation (exclusive).
i.e. (*blockp)[blocki_beg‥blocki_end]
sourcepub fn fileoffset_begin(&self) -> FileOffset
pub fn fileoffset_begin(&self) -> FileOffset
FileOffset
at beginning of the LinePart
(inclusive).
sourcepub fn fileoffset_end(&self) -> FileOffset
pub fn fileoffset_end(&self) -> FileOffset
FileOffset
at one byte past ending of the LinePart
(exclusive).
sourcepub fn blockoffset(&self) -> BlockOffset
pub fn blockoffset(&self) -> BlockOffset
BlockOffset
of underlying Block
to which blockp
points.
sourcepub fn count_bytes(&self) -> Count
pub fn count_bytes(&self) -> Count
Count of bytes of this LinePart
.
XXX: count_bytes
and len
is overlapping and confusing.
sourcepub fn block_boxptr(&self) -> Box<&[u8]>
pub fn block_boxptr(&self) -> Box<&[u8]>
Return Box
pointer to slice of bytes that make up this
LinePart
.
sourcepub fn block_boxptr_a(&self, a: &LineIndex) -> Box<&[u8]>
pub fn block_boxptr_a(&self, a: &LineIndex) -> Box<&[u8]>
Return Box
pointer to slice of bytes in this LinePart
from a
(inclusive) to end.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LinePart
impl RefUnwindSafe for LinePart
impl Send for LinePart
impl Sync for LinePart
impl Unpin for LinePart
impl UnwindSafe for LinePart
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
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>
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>
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