pub struct WorkerRefusal { /* private fields */ }Expand description
A validated refusal. Words are data and are never included in Debug.
Implementations§
Source§impl WorkerRefusal
impl WorkerRefusal
Sourcepub fn new(code: &str, words: impl AsRef<str>) -> Result<Self, ProtocolError>
pub fn new(code: &str, words: impl AsRef<str>) -> Result<Self, ProtocolError>
Validates the closed code and the byte bound before retaining words.
§Errors
An unknown code or words exceeding the configured wire ceiling.
Sourcepub const fn code(&self) -> WorkerRefusalCode
pub const fn code(&self) -> WorkerRefusalCode
The validated worker reason.
Sourcepub fn into_words(self) -> String
pub fn into_words(self) -> String
Transfers the words to the caller without another allocation.
Sourcepub fn canonical_bytes(&self) -> Result<Vec<u8>, ProtocolError>
pub fn canonical_bytes(&self) -> Result<Vec<u8>, ProtocolError>
Compact JSON through a sorted value, the console’s canonical form.
§Errors
The canonical JSON encoder failed; its input is never quoted.
Sourcepub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
pub fn decode(payload: &[u8]) -> Result<Self, ProtocolError>
Accepts only the exact canonical record, including its member order and spelling. Comparing the re-encoding also rejects duplicate members and alternate escapes without ever copying their values into an error.
§Errors
An oversized, malformed, noncanonical or out-of-vocabulary record.
Trait Implementations§
Source§impl Clone for WorkerRefusal
impl Clone for WorkerRefusal
Source§impl Debug for WorkerRefusal
impl Debug for WorkerRefusal
impl Eq for WorkerRefusal
Source§impl PartialEq for WorkerRefusal
impl PartialEq for WorkerRefusal
impl StructuralPartialEq for WorkerRefusal
Auto Trait Implementations§
impl Freeze for WorkerRefusal
impl RefUnwindSafe for WorkerRefusal
impl Send for WorkerRefusal
impl Sync for WorkerRefusal
impl Unpin for WorkerRefusal
impl UnsafeUnpin for WorkerRefusal
impl UnwindSafe for WorkerRefusal
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.