#[repr(u16)]pub enum StatusCode {
OK,
MalformedProtocolMessage,
UnexpectedProtocolMessage,
InvalidRequest,
InvalidLastBlock,
InvalidUnconfirmedBlock,
InvaildDifficultyBoundary,
InternalError,
Network,
}Expand description
StatusCodes indicate whether a specific operation has been successfully completed.
The StatusCode element is a 3-digit integer.
The first digest of the StatusCode defines the class of result:
- 1xx: Informational response – the request was received, continuing process.
- 2xx: Success - The action requested by the client was received, understood, and accepted.
- 4xx: Client errors - The error seems to have been caused by the client.
- 5xx: Server errors - The server failed to fulfil a request.
Variants§
OK
OK
MalformedProtocolMessage
Malformed protocol message.
UnexpectedProtocolMessage
Unexpected light-client protocol message.
InvalidRequest
The request data is incorrect.
InvalidLastBlock
The last block sent from client is invalid.
InvalidUnconfirmedBlock
At least one unconfirmed block sent from client is invalid.
InvaildDifficultyBoundary
The difficulty boundary is not in the provided block range.
InternalError
Throws an internal error.
Network
Throws an error from the network.
Implementations§
source§impl StatusCode
impl StatusCode
sourcepub fn with_context<S: ToString>(self, context: S) -> Status
pub fn with_context<S: ToString>(self, context: S) -> Status
Convert a status code into a status which has a context.
Trait Implementations§
source§impl Clone for StatusCode
impl Clone for StatusCode
source§fn clone(&self) -> StatusCode
fn clone(&self) -> StatusCode
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for StatusCode
impl Debug for StatusCode
source§impl From<StatusCode> for Status
impl From<StatusCode> for Status
source§fn from(code: StatusCode) -> Self
fn from(code: StatusCode) -> Self
Converts to this type from the input type.
source§impl PartialEq<StatusCode> for StatusCode
impl PartialEq<StatusCode> for StatusCode
source§fn eq(&self, other: &StatusCode) -> bool
fn eq(&self, other: &StatusCode) -> bool
This method tests for
self and other values to be equal, and is used
by ==.impl Copy for StatusCode
impl Eq for StatusCode
impl StructuralEq for StatusCode
impl StructuralPartialEq for StatusCode
Auto Trait Implementations§
impl RefUnwindSafe for StatusCode
impl Send for StatusCode
impl Sync for StatusCode
impl Unpin for StatusCode
impl UnwindSafe for StatusCode
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