Partition

Struct Partition 

Source
pub struct Partition<'a, IO> { /* private fields */ }
Expand description

Used to interface with partitions

Implementations§

Source§

impl<'a, IO: Io + Seek> Partition<'a, IO>

Source

pub fn new( start_pos: u64, end_pos: u64, io: &'a mut IO, ) -> Result<Self, <Self as Io>::Error>

Create a new partition given the start and end position

Source§

impl<'a, IO> Partition<'a, IO>

Source

pub fn len(&self) -> u64

Get the length of the partition in bytes

Trait Implementations§

Source§

impl<'a, IO: Io> Io for Partition<'a, IO>

Source§

type Error = <IO as Io>::Error

Error type of all the IO operations on this type.
Source§

impl<'a, IO: Read> Read for Partition<'a, IO>

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>

Pull some bytes from this source into the specified buffer, returning how many bytes were read.
Source§

fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>

Read the exact number of bytes required to fill buf.
Source§

impl<'a, IO: Seek> Seek for Partition<'a, IO>

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64, Self::Error>

Seek to an offset, in bytes, in a stream.
Source§

fn rewind(&mut self) -> Result<(), Self::Error>

Rewind to the beginning of a stream.
Source§

fn stream_position(&mut self) -> Result<u64, Self::Error>

Returns the current seek position from the start of the stream.
Source§

impl<'a, IO: Write> Write for Partition<'a, IO>

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>

Write a buffer into this writer, returning how many bytes were written.
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer.
Source§

fn write_fmt( &mut self, fmt: Arguments<'_>, ) -> Result<(), WriteFmtError<Self::Error>>

Write a formatted string into this writer, returning any error encountered.

Auto Trait Implementations§

§

impl<'a, IO> Freeze for Partition<'a, IO>

§

impl<'a, IO> RefUnwindSafe for Partition<'a, IO>
where IO: RefUnwindSafe,

§

impl<'a, IO> Send for Partition<'a, IO>
where IO: Send,

§

impl<'a, IO> Sync for Partition<'a, IO>
where IO: Sync,

§

impl<'a, IO> Unpin for Partition<'a, IO>

§

impl<'a, IO> !UnwindSafe for Partition<'a, IO>

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.