#[non_exhaustive]pub enum WriteError {
Full,
Forbidden {
at: u32,
},
OutOfRange,
NotToken,
InvalidSequence,
}Expand description
Why a writer refused.
§Examples
use parse_net::{write, SliceSink, WriteError};
let mut buf = [0u8; 64];
let mut out = SliceSink::new(&mut buf);
let err = write::write_field_value(b"evil\r\nSet-Cookie: x=1", &mut out).unwrap_err();
assert_eq!(err, WriteError::Forbidden { at: 4 });
assert!(out.written().is_empty());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Full
The sink has no room. When the sink reports its room (as
SliceSink does), nothing was written. Retry with
a larger buffer; CountSink gives the exact
length.
Forbidden
The input byte at offset at is not allowed in the output grammar
(CR, LF, NUL, another control, or a byte the format forbids). Refuse
the input; never strip it and retry silently.
OutOfRange
A number outside the format’s range.
NotToken
A position that requires a token got something else.
InvalidSequence
A structured writer was called out of order, such as a parameter before any item. A bug in the calling code.
Trait Implementations§
Source§impl Clone for WriteError
impl Clone for WriteError
impl Copy for WriteError
Source§impl Debug for WriteError
impl Debug for WriteError
Source§impl Display for WriteError
impl Display for WriteError
impl Eq for WriteError
Source§impl Error for WriteError
impl Error for WriteError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Full> for WriteError
impl From<Full> for WriteError
Source§impl Hash for WriteError
impl Hash for WriteError
Source§impl PartialEq for WriteError
impl PartialEq for WriteError
impl StructuralPartialEq for WriteError
Auto Trait Implementations§
impl Freeze for WriteError
impl RefUnwindSafe for WriteError
impl Send for WriteError
impl Sync for WriteError
impl Unpin for WriteError
impl UnsafeUnpin for WriteError
impl UnwindSafe for WriteError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more