aboutsummaryrefslogtreecommitdiff
path: root/src/reader.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/reader.rs b/src/reader.rs
index b9514ae..8b68486 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -1,4 +1,4 @@
-use crate::StandardDecodeError;
+use crate::{StandardDecodeError, StandardPartialDecoderError};
impl From<ReadError> for StandardDecodeError {
fn from(_: ReadError) -> StandardDecodeError {
@@ -6,6 +6,12 @@ impl From<ReadError> for StandardDecodeError {
}
}
+impl From<ReadError> for StandardPartialDecoderError {
+ fn from(_: ReadError) -> StandardPartialDecoderError {
+ StandardPartialDecoderError::ExhaustedInput
+ }
+}
+
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
pub enum ReadError {
ExhaustedInput,
@@ -18,8 +24,9 @@ pub enum ReadError {
/// isn't a multiple of 8 bits, `U8Reader` won't be sufficient.
pub trait Reader<Address, Item> {
fn next(&mut self) -> Result<Item, ReadError>;
- /// read `buf`-many items from this reader in bulk. if `Reader` cannot read `buf`-many items,
- /// return `ReadError::ExhaustedInput`.
+ /// read `buf`-many items from this reader in bulk.
+ ///
+ /// if `Reader` cannot read `buf`-many items, return `ReadError::ExhaustedInput`.
fn next_n(&mut self, buf: &mut [Item]) -> Result<(), ReadError>;
/// mark the current position as where to measure `offset` against.
fn mark(&mut self);