pub struct RpcError {
pub code: i64,
pub message: String,
pub data: Option<Value>,
}
Expand description
An error code.
Fields§
§code: i64
§message: String
§data: Option<Value>
Implementations§
Source§impl RpcError
impl RpcError
Sourcepub fn new(code: i64, message: String, data: Option<Value>) -> Self
pub fn new(code: i64, message: String, data: Option<Value>) -> Self
A generic constructor.
Mostly for completeness, doesn’t do anything but filling in the corresponding fields.
Sourcepub fn invalid_params(msg: Option<String>) -> Self
pub fn invalid_params(msg: Option<String>) -> Self
Create an Invalid Param error.
Sourcepub fn server_error<E: Serialize>(e: Option<E>) -> Self
pub fn server_error<E: Serialize>(e: Option<E>) -> Self
Create a server error.
Sourcepub fn invalid_request() -> Self
pub fn invalid_request() -> Self
Create an invalid request error.
Sourcepub fn parse_error(e: String) -> Self
pub fn parse_error(e: String) -> Self
Create a parse error.
Sourcepub fn method_not_found(method: String) -> Self
pub fn method_not_found(method: String) -> Self
Create a method not found error.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RpcError
impl<'de> Deserialize<'de> for RpcError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for RpcError
Auto Trait Implementations§
impl Freeze for RpcError
impl RefUnwindSafe for RpcError
impl Send for RpcError
impl Sync for RpcError
impl Unpin 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