pub struct Refusal<'a> {
pub reason: RefusalReason,
pub capability: Capability,
pub detail: &'a str,
}Expand description
One side declining to go on, and saying why.
The reason a refusal is a record rather than a dropped connection is that “this did not work” is not an actionable message. Somebody has to be able to read the failure and know which capability to go and implement.
Fields§
§reason: RefusalReasonThe category of problem.
capability: CapabilityWhich capability was missing, when reason is RefusalReason::MISSING_CAPABILITY.
detail: &'a strText for a human. Not parsed by anything.
Implementations§
Source§impl<'a> Refusal<'a>
impl<'a> Refusal<'a>
Sourcepub const fn new(reason: RefusalReason, detail: &'a str) -> Self
pub const fn new(reason: RefusalReason, detail: &'a str) -> Self
A refusal with no particular capability attached.
Sourcepub fn decode(version: u16, p: &mut Reader<'a>) -> Result<Self>
pub fn decode(version: u16, p: &mut Reader<'a>) -> Result<Self>
Reads the record from its payload.
§Errors
Returns Error::UnsupportedVersion if the layout version is not one this build knows,
Error::Truncated if the payload ends early, or Error::NotUtf8 if the detail is not
text.
Trait Implementations§
impl<'a> Copy for Refusal<'a>
impl<'a> Eq for Refusal<'a>
impl<'a> StructuralPartialEq for Refusal<'a>
Auto Trait Implementations§
impl<'a> Freeze for Refusal<'a>
impl<'a> RefUnwindSafe for Refusal<'a>
impl<'a> Send for Refusal<'a>
impl<'a> Sync for Refusal<'a>
impl<'a> Unpin for Refusal<'a>
impl<'a> UnsafeUnpin for Refusal<'a>
impl<'a> UnwindSafe for Refusal<'a>
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