Rename bencode::Error::ExtraData -> TrailingData
type: reform
This commit is contained in:
parent
7de1c04776
commit
7420c91553
|
@ -101,7 +101,7 @@ impl<'buffer> Display for Value<'buffer> {
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub(crate) enum Error {
|
pub(crate) enum Error {
|
||||||
ExtraData { start: usize },
|
TrailingData { start: usize },
|
||||||
UnexpectedEndOfBuffer,
|
UnexpectedEndOfBuffer,
|
||||||
UnexpectedByte { found: u8 },
|
UnexpectedByte { found: u8 },
|
||||||
UnsortedKey,
|
UnsortedKey,
|
||||||
|
@ -127,7 +127,7 @@ impl<'buffer> Parser<'buffer> {
|
||||||
let root = self.value()?;
|
let root = self.value()?;
|
||||||
|
|
||||||
if self.index != self.buffer.len() {
|
if self.index != self.buffer.len() {
|
||||||
return Err(ExtraData { start: self.index });
|
return Err(TrailingData { start: self.index });
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(root)
|
Ok(root)
|
||||||
|
@ -334,10 +334,10 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn misc() {
|
fn misc() {
|
||||||
err("", UnexpectedEndOfBuffer);
|
err("", UnexpectedEndOfBuffer);
|
||||||
err("i20efoo", ExtraData { start: 4 });
|
err("i20efoo", TrailingData { start: 4 });
|
||||||
err("defoo", ExtraData { start: 2 });
|
err("defoo", TrailingData { start: 2 });
|
||||||
err("lefoo", ExtraData { start: 2 });
|
err("lefoo", TrailingData { start: 2 });
|
||||||
err("1:afoo", ExtraData { start: 3 });
|
err("1:afoo", TrailingData { start: 3 });
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user