pub struct MerkleStream<T> { /* private fields */ }

Implementations§

source§

impl<T: MetaReader> MerkleStream<T>

source

pub fn assert_root_integrity(&mut self) -> Result<()>

Asserts that the root merkle node contains the integrity value given by the inner stream.

source§

impl<T: ReadAt + Size + Sectored> MerkleStream<T>

source

pub fn new(inner: T) -> Result<MerkleStream<T>>

Reads a MerkleTree from the end of the given stream and returns a stream which uses it.

source

pub fn with_tree(inner: T, tree: VariantMerkleTree) -> Result<MerkleStream<T>>

Trait Implementations§

source§

impl<U, T: AsMut<U>> AsMut<U> for MerkleStream<T>

source§

fn as_mut(&mut self) -> &mut U

Converts this type into a mutable reference of the (usually inferred) input type.
source§

impl<U, T: AsRef<U>> AsRef<U> for MerkleStream<T>

source§

fn as_ref(&self) -> &U

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<T> Decompose<T> for MerkleStream<T>

source§

fn into_inner(self) -> T

source§

impl<T: FlushMeta> FlushMeta for MerkleStream<T>

source§

fn flush_meta(&mut self) -> Result<()>

Flushes metadata to persistent storage.
source§

impl<T: ReadAt + Size> ReadAt for MerkleStream<T>

source§

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

Reads bytes from an offset in this source into a buffer, returning how many bytes were read. Read more
source§

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

Reads the exact number of bytes required to fill buf from an offset. Read more
source§

impl<T> Sectored for MerkleStream<T>

source§

fn sector_sz(&self) -> usize

Returns the size of the sector for this stream.
source§

fn sector_sz64(&self) -> u64

Returns the sector size as a u64.
source§

fn assert_sector_sz(&self, actual: usize) -> Result<()>

Returns Err(Error::IncorrectSize) if the given size is not equal to the sector size.
source§

fn assert_at_least_sector_sz(&self, actual: usize) -> Result<()>

Returns Err(Error::IncorrectSize) if the given size is less than the sector size.
source§

fn offset_at(&self, index: u64) -> u64

Returns the offset (in bytes) from the beginning of this stream that the given 0-based sector index corresponds to.
source§

impl<T> Size for MerkleStream<T>

source§

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

Get the size of this object, in bytes. Read more
source§

impl<T: WriteInteg + Size> WriteAt for MerkleStream<T>

source§

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

Writes bytes from a buffer to an offset, returning the number of bytes written. Read more
source§

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

Flush this writer, ensuring that any intermediately buffered data reaches its destination. Read more
source§

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

Writes a complete buffer at an offset. Read more

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for MerkleStream<T>where T: RefUnwindSafe,

§

impl<T> Send for MerkleStream<T>where T: Send,

§

impl<T> Sync for MerkleStream<T>where T: Sync,

§

impl<T> Unpin for MerkleStream<T>where T: Unpin,

§

impl<T> UnwindSafe for MerkleStream<T>where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Free for T

§

unsafe default fn free(ptr_ref: NonNull<T>)

Drops the content pointed by this pointer and frees it. 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 Twhere 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> MetaAccess for Twhere T: AsMut<BlockMeta> + MetaReader + ?Sized,

source§

fn mut_meta(&mut self) -> &mut BlockMeta

source§

fn mut_meta_body(&mut self) -> &mut BlockMetaBody

source§

impl<T> MetaReader for Twhere T: AsRef<BlockMeta> + Size + ?Sized,

source§

impl<R> ReadBytesAtExt for Rwhere R: ReadAt,

source§

fn read_u8_at(&self, pos: u64) -> Result<u8, Error>

Reads an unsigned 8-bit integer at an offset.
source§

fn read_i8_at(&self, pos: u64) -> Result<i8, Error>

Reads a signed 8-bit integer at an offset.
source§

fn read_u16_at<T>(&self, pos: u64) -> Result<u16, Error>where T: ByteOrder,

Reads an unsigned 16-bit integer at an offset.
source§

fn read_i16_at<T>(&self, pos: u64) -> Result<i16, Error>where T: ByteOrder,

Reads a signed 16-bit integer at an offset.
source§

fn read_u32_at<T>(&self, pos: u64) -> Result<u32, Error>where T: ByteOrder,

Reads an unsigned 32-bit integer at an offset.
source§

fn read_i32_at<T>(&self, pos: u64) -> Result<i32, Error>where T: ByteOrder,

Reads a signed 32-bit integer at an offset.
source§

fn read_u64_at<T>(&self, pos: u64) -> Result<u64, Error>where T: ByteOrder,

Reads an unsigned 64-bit integer at an offset.
source§

fn read_i64_at<T>(&self, pos: u64) -> Result<i64, Error>where T: ByteOrder,

Reads a signed 64-bit integer at an offset.
source§

fn read_uint_at<T>(&self, pos: u64, nbytes: usize) -> Result<u64, Error>where T: ByteOrder,

Reads an unsigned nbytes-bit integer at an offset.
source§

fn read_int_at<T>(&self, pos: u64, nbytes: usize) -> Result<i64, Error>where T: ByteOrder,

Reads a signed nbytes-bit integer at an offset.
source§

fn read_f32_at<T>(&self, pos: u64) -> Result<f32, Error>where T: ByteOrder,

Reads a single-precision floating point number at an offset.
source§

fn read_f64_at<T>(&self, pos: u64) -> Result<f64, Error>where T: ByteOrder,

Reads a double-precision floating point number at an offset.
source§

impl<T> SizeExt for Twhere T: Size,

source§

impl<T> ToHex for Twhere T: AsRef<[u8]>,

source§

fn encode_hex<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
source§

fn encode_hex_upper<U>(&self) -> Uwhere U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<W> WriteBytesAtExt for Wwhere W: WriteAt,

source§

fn write_u8_at(&mut self, pos: u64, n: u8) -> Result<(), Error>

Writes an unsigned 8-bit integer to an offset.
source§

fn write_i8_at(&mut self, pos: u64, n: i8) -> Result<(), Error>

Writes a signed 8-bit integer to an offset.
source§

fn write_u16_at<T>(&mut self, pos: u64, n: u16) -> Result<(), Error>where T: ByteOrder,

Writes an unsigned 16-bit integer to an offset.
source§

fn write_i16_at<T>(&mut self, pos: u64, n: i16) -> Result<(), Error>where T: ByteOrder,

Writes a signed 16-bit integer to an offset.
source§

fn write_u32_at<T>(&mut self, pos: u64, n: u32) -> Result<(), Error>where T: ByteOrder,

Writes an unsigned 32-bit integer to an offset.
source§

fn write_i32_at<T>(&mut self, pos: u64, n: i32) -> Result<(), Error>where T: ByteOrder,

Writes a signed 32-bit integer to an offset.
source§

fn write_u64_at<T>(&mut self, pos: u64, n: u64) -> Result<(), Error>where T: ByteOrder,

Writes an unsigned 64-bit integer to an offset.
source§

fn write_i64_at<T>(&mut self, pos: u64, n: i64) -> Result<(), Error>where T: ByteOrder,

Writes a signed 64-bit integer to an offset.
source§

fn write_uint_at<T>( &mut self, pos: u64, n: u64, nbytes: usize ) -> Result<(), Error>where T: ByteOrder,

Writes an unsigned nbytes-bit integer to an offset.
source§

fn write_int_at<T>( &mut self, pos: u64, n: i64, nbytes: usize ) -> Result<(), Error>where T: ByteOrder,

Writes a signed nbytes-bit integer to an offset.
source§

fn write_f32_at<T>(&mut self, pos: u64, n: f32) -> Result<(), Error>where T: ByteOrder,

Writes a single-precision floating point number to an offset.
source§

fn write_f64_at<T>(&mut self, pos: u64, n: f64) -> Result<(), Error>where T: ByteOrder,

Writes a double-precision floating point number to an offset.
source§

impl<T> Block for Twhere T: ReadAt + WriteAt + MetaAccess + Sectored + FlushMeta + ?Sized,