pub struct AlignedRead<'a, T, A: Alignment = A1> { /* private fields */ }Expand description
Disk-IO read request, parameterized by its required memory alignment A.
Three constraints govern a read:
- Disk offset alignment.
- Buffer length alignment.
- Buffer pointer alignment in memory.
All three are checked against A::VALUE at construction time by
AlignedRead::new. A typed AlignedRead<T, A> is therefore a witness
that the request satisfies its declared alignment, and the file reader’s
read method can rely on it without re-checking.
Implementations§
Source§impl<'a, T, A: Alignment> AlignedRead<'a, T, A>
impl<'a, T, A: Alignment> AlignedRead<'a, T, A>
Sourcepub fn new(offset: u64, aligned_buf: &'a mut [T]) -> ANNResult<Self>
pub fn new(offset: u64, aligned_buf: &'a mut [T]) -> ANNResult<Self>
Build an AlignedRead after validating that offset, the buffer
length (in bytes), and the buffer pointer all satisfy A::VALUE.
pub fn offset(&self) -> u64
pub fn aligned_buf(&self) -> &[T]
pub fn aligned_buf_mut(&mut self) -> &mut [T]
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, A = A1> !UnwindSafe for AlignedRead<'a, T, A>
impl<'a, T, A> Freeze for AlignedRead<'a, T, A>
impl<'a, T, A> RefUnwindSafe for AlignedRead<'a, T, A>where
A: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T, A> Send for AlignedRead<'a, T, A>
impl<'a, T, A> Sync for AlignedRead<'a, T, A>
impl<'a, T, A> Unpin for AlignedRead<'a, T, A>where
A: Unpin,
impl<'a, T, A> UnsafeUnpin for AlignedRead<'a, T, A>
Blanket Implementations§
impl<T> AsyncFriendly for T
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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