delete PlainParseError
This commit is contained in:
parent
34b60a9950
commit
8332f89363
@ -1,5 +1,7 @@
|
|||||||
//! [`Plain`] type for storing raw byte sequnces.
|
//! [`Plain`] type for storing raw byte sequnces.
|
||||||
|
|
||||||
|
use std::convert::Infallible;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
/// Raw bytes storage. Use [`Plain::raw`] to get the data.
|
/// Raw bytes storage. Use [`Plain::raw`] to get the data.
|
||||||
@ -10,18 +12,6 @@ pub struct Plain {
|
|||||||
data: Vec<u8>,
|
data: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This shouldn't happen given [`Deserializer::read_all`] being used for parsing.
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum PlainParseError {}
|
|
||||||
|
|
||||||
impl Display for PlainParseError {
|
|
||||||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
match *self {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Error for PlainParseError {}
|
|
||||||
|
|
||||||
impl Serializable for Plain {
|
impl Serializable for Plain {
|
||||||
fn serialize(&self, serializer: &mut dyn Serializer) {
|
fn serialize(&self, serializer: &mut dyn Serializer) {
|
||||||
serializer.write(&self.data)
|
serializer.write(&self.data)
|
||||||
@ -29,7 +19,7 @@ impl Serializable for Plain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AtomicBase for Plain {
|
impl AtomicBase for Plain {
|
||||||
type AParseError = PlainParseError;
|
type AParseError = Infallible;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ImplMode for Plain {
|
impl ImplMode for Plain {
|
||||||
@ -65,9 +55,8 @@ mod tests {
|
|||||||
use crate::rstd::*;
|
use crate::rstd::*;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_parse_plain_slice() -> Result<(), PlainParseError> {
|
fn can_parse_plain_slice() {
|
||||||
let plain = Plain::parse_slice(b"slice")?;
|
let plain = Plain::parse_slice(b"slice").unwrap();
|
||||||
assert_eq!(plain.bytes().as_slice(), b"slice");
|
assert_eq!(plain.bytes().as_slice(), b"slice");
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user