pub struct SegmentInfo {
pub start: IndexPos,
pub end: IndexPos,
pub pattern: Bucket,
}Expand description
Information about a contiguous segment of the block device with a specific data pattern.
A test block device is divided into multiple segments, where each segment uses a different data pattern type (Fill, Duplicate, or Random). This struct describes a single segment’s location and pattern type.
§Examples
use test_bd::{SegmentInfo, IndexPos, Bucket};
let segment = SegmentInfo {
start: IndexPos::new(0),
end: IndexPos::new(1024),
pattern: Bucket::Fill,
};
assert_eq!(segment.count(), 1024);
assert_eq!(segment.size_bytes(), 8192); // 1024 * 8 bytesFields§
§start: IndexPosStarting position of this segment (inclusive).
end: IndexPosEnding position of this segment (exclusive).
pattern: BucketThe data pattern type used in this segment.
Implementations§
Source§impl SegmentInfo
impl SegmentInfo
Sourcepub fn count(&self) -> u64
pub fn count(&self) -> u64
Returns the number of 8-byte elements in this segment.
§Examples
use test_bd::{SegmentInfo, IndexPos, Bucket};
let segment = SegmentInfo {
start: IndexPos::new(0),
end: IndexPos::new(100),
pattern: Bucket::Random,
};
assert_eq!(segment.count(), 100);Sourcepub fn size_bytes(&self) -> u64
pub fn size_bytes(&self) -> u64
Returns the size of this segment in bytes.
§Examples
use test_bd::{SegmentInfo, IndexPos, Bucket};
let segment = SegmentInfo {
start: IndexPos::new(0),
end: IndexPos::new(100),
pattern: Bucket::Random,
};
assert_eq!(segment.size_bytes(), 800); // 100 * 8 bytesTrait Implementations§
Source§impl Clone for SegmentInfo
impl Clone for SegmentInfo
Source§fn clone(&self) -> SegmentInfo
fn clone(&self) -> SegmentInfo
Returns a duplicate 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 SegmentInfo
impl Debug for SegmentInfo
Source§impl<'de> Deserialize<'de> for SegmentInfo
impl<'de> Deserialize<'de> for SegmentInfo
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 for SegmentInfo
impl PartialEq for SegmentInfo
Source§impl Serialize for SegmentInfo
impl Serialize for SegmentInfo
impl Eq for SegmentInfo
impl StructuralPartialEq for SegmentInfo
Auto Trait Implementations§
impl Freeze for SegmentInfo
impl RefUnwindSafe for SegmentInfo
impl Send for SegmentInfo
impl Sync for SegmentInfo
impl Unpin for SegmentInfo
impl UnwindSafe for SegmentInfo
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