pub struct RpcError { /* private fields */ }Implementations§
Source§impl RpcError
impl RpcError
pub fn new_code(code: i16) -> Self
Sourcepub fn server<E: ToString>(code: i16, e: E) -> Self
pub fn server<E: ToString>(code: i16, e: E) -> Self
Constructs a server error by ToStringing another type and using a
specific error code.
pub fn code(&self) -> i16
pub fn raw_msg(&self) -> Option<&[u8]>
Sourcepub fn kind(&self) -> RpcErrorKind
pub fn kind(&self) -> RpcErrorKind
Returns the error converted to an RpcErrorKind which can be matched on
more easily.
Sourcepub fn try_parse_msg(&self) -> Option<&str>
pub fn try_parse_msg(&self) -> Option<&str>
Returns the error message as a string, if there is one and it can be parsed as one.
Sourcepub fn from_slice(buf: &[u8]) -> Result<Self, Error>
pub fn from_slice(buf: &[u8]) -> Result<Self, Error>
Decodes an error type from a vector of bytes. Assumes the buf is already appropriately sized.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RpcError
impl RefUnwindSafe for RpcError
impl Send for RpcError
impl Sync for RpcError
impl Unpin for RpcError
impl UnsafeUnpin for RpcError
impl UnwindSafe for RpcError
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