Struct den::SegmentRef
source · pub struct SegmentRef {
pub start: usize,
pub block_count: usize,
}
Expand description
One or more successive blocks found in the common data.
Fields§
§start: usize
Start of segment with a length of Self::block_count
*Signature::block_size
.
block_count: usize
The number of blocks this segment references.
Implementations§
source§impl SegmentRef
impl SegmentRef
sourcepub fn block_count(self) -> usize
pub fn block_count(self) -> usize
The number of blocks this reference covers.
sourcepub fn end(self, block_size: usize) -> usize
pub fn end(self, block_size: usize) -> usize
The end of this segment.
The same as Self::start
+ Self::block_count
* block_size
.
sourcepub fn len_to_end(
self,
diff: &Difference<impl ExtendVec + 'static>
) -> Option<usize>
pub fn len_to_end( self, diff: &Difference<impl ExtendVec + 'static> ) -> Option<usize>
Get the length to the end of diff
. If this Segment::Ref
doesn’t reach diff
’s end,
None
is returned. Else, the count of bytes until the end of copying is returned.
sourcepub fn with_start(self, start: usize) -> Self
pub fn with_start(self, start: usize) -> Self
Get a new SegmentRef
with Self::start
set to start
.
sourcepub fn with_blocks(self, n: usize) -> Self
pub fn with_blocks(self, n: usize) -> Self
Get a new SegmentRef
with Self::block_count
set to n
.
sourcepub fn extend(&mut self, n: usize)
pub fn extend(&mut self, n: usize)
Add n
to Self::block_count
.
Trait Implementations§
source§impl Clone for SegmentRef
impl Clone for SegmentRef
source§fn clone(&self) -> SegmentRef
fn clone(&self) -> SegmentRef
Returns a copy 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 SegmentRef
impl Debug for SegmentRef
source§impl<'de> Deserialize<'de> for SegmentRef
impl<'de> Deserialize<'de> for SegmentRef
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<SegmentRef> for SegmentRef
impl PartialEq<SegmentRef> for SegmentRef
source§fn eq(&self, other: &SegmentRef) -> bool
fn eq(&self, other: &SegmentRef) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.