Skip to main content

TakeRange

Struct TakeRange 

Source
pub struct TakeRange<T: ?Sized> { /* private fields */ }
Expand description

An adapter that limits the range of a ReadAt or WriteAt.

This can be obtained by calling Size::take_range.

Implementations§

Source§

impl<T: ?Sized> TakeRange<T>

Source

pub fn get_ref(&self) -> &T

Gets a reference to the underlying stream.

Source

pub fn get_mut(&mut self) -> &mut T

Gets a mutable reference to the underlying stream.

Source

pub fn into_inner(self) -> T
where T: Sized,

Consumes the TakeRange, returning the wrapped stream.

Trait Implementations§

Source§

impl<T: ReadAt + ?Sized> ReadAt for TakeRange<T>

Source§

fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>

Reads a number of bytes starting from a given offset. Read more
Source§

fn read_exact_at(&self, buf: &mut [u8], offset: u64) -> Result<()>

Reads the exact number of byte required to fill buf from the given offset. Read more
Source§

fn read_vectored_at( &self, bufs: &mut [IoSliceMut<'_>], offset: u64, ) -> Result<usize>

Like read_at, except that it reads into a slice of buffers. Read more
Source§

impl<T: Size + ?Sized> Size for TakeRange<T>

Source§

fn size(&self) -> Result<u64>

Returns the size of the stream.
Source§

fn take_range(self, range: impl RangeBounds<u64>) -> TakeRange<Self>
where Self: Sized,

Creates an adapter which only reads and write within the given range. Read more
Source§

impl<T: WriteAt + ?Sized> WriteAt for TakeRange<T>

Source§

fn write_at(&self, buf: &[u8], offset: u64) -> Result<usize>

Writes a number of bytes starting from a given offset. Read more
Source§

fn write_all_at(&self, buf: &[u8], offset: u64) -> Result<()>

Attempts to write an entire buffer starting from a given offset. Read more
Source§

fn write_vectored_at(&self, bufs: &[IoSlice<'_>], offset: u64) -> Result<usize>

Like write_at, except that it writes from a slice of buffers. Read more
Source§

fn flush(&self) -> Result<()>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more

Auto Trait Implementations§

§

impl<T> Freeze for TakeRange<T>
where T: Freeze + ?Sized,

§

impl<T> RefUnwindSafe for TakeRange<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for TakeRange<T>
where T: Send + ?Sized,

§

impl<T> Sync for TakeRange<T>
where T: Sync + ?Sized,

§

impl<T> Unpin for TakeRange<T>
where T: Unpin + ?Sized,

§

impl<T> UnsafeUnpin for TakeRange<T>
where T: UnsafeUnpin + ?Sized,

§

impl<T> UnwindSafe for TakeRange<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.