Enum cuprate_rpc_types::Status
source · pub enum Status {
Ok,
Busy,
NotMining,
PaymentRequired,
Unknown,
}Expand description
RPC response status.
This type represents monerod’s frequently appearing string field, status.
This field appears within RPC JSON response types.
§Serialization and string formatting
use cuprate_rpc_types::{
Status,
CORE_RPC_STATUS_BUSY, CORE_RPC_STATUS_NOT_MINING, CORE_RPC_STATUS_OK,
CORE_RPC_STATUS_PAYMENT_REQUIRED, CORE_RPC_STATUS_UNKNOWN
};
use serde_json::to_string;
let unknown = Status::Unknown;
assert_eq!(to_string(&Status::Ok).unwrap(), r#""OK""#);
assert_eq!(to_string(&Status::Busy).unwrap(), r#""BUSY""#);
assert_eq!(to_string(&Status::NotMining).unwrap(), r#""NOT MINING""#);
assert_eq!(to_string(&Status::PaymentRequired).unwrap(), r#""PAYMENT REQUIRED""#);
assert_eq!(to_string(&unknown).unwrap(), r#""UNKNOWN""#);
assert_eq!(Status::Ok.as_ref(), CORE_RPC_STATUS_OK);
assert_eq!(Status::Busy.as_ref(), CORE_RPC_STATUS_BUSY);
assert_eq!(Status::NotMining.as_ref(), CORE_RPC_STATUS_NOT_MINING);
assert_eq!(Status::PaymentRequired.as_ref(), CORE_RPC_STATUS_PAYMENT_REQUIRED);
assert_eq!(unknown.as_ref(), CORE_RPC_STATUS_UNKNOWN);
assert_eq!(format!("{}", Status::Ok), CORE_RPC_STATUS_OK);
assert_eq!(format!("{}", Status::Busy), CORE_RPC_STATUS_BUSY);
assert_eq!(format!("{}", Status::NotMining), CORE_RPC_STATUS_NOT_MINING);
assert_eq!(format!("{}", Status::PaymentRequired), CORE_RPC_STATUS_PAYMENT_REQUIRED);
assert_eq!(format!("{}", unknown), CORE_RPC_STATUS_UNKNOWN);
assert_eq!(format!("{:?}", Status::Ok), "Ok");
assert_eq!(format!("{:?}", Status::Busy), "Busy");
assert_eq!(format!("{:?}", Status::NotMining), "NotMining");
assert_eq!(format!("{:?}", Status::PaymentRequired), "PaymentRequired");
assert_eq!(format!("{:?}", unknown), "Unknown");Variants§
Ok
Successful RPC response, everything is OK; CORE_RPC_STATUS_OK.
Busy
The daemon is busy, try later; CORE_RPC_STATUS_BUSY.
NotMining
The daemon is not mining; CORE_RPC_STATUS_NOT_MINING.
PaymentRequired
Payment is required for RPC; CORE_RPC_STATUS_PAYMENT_REQUIRED.
Unknown
Some unknown other string; CORE_RPC_STATUS_UNKNOWN.
This exists to act as a catch-all if monerod adds
a string and a Cuprate node hasn’t updated yet.
The reason this isn’t Unknown(String) is because that
disallows Status to be Copy, and thus other types
that contain it.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Status
impl<'de> Deserialize<'de> for Status
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>,
source§impl EpeeValue for Status
impl EpeeValue for Status
const MARKER: Marker = <String as EpeeValue>::MARKER
fn read<B: Buf>(r: &mut B, marker: &Marker) -> Result<Self>
fn should_write(&self) -> bool
source§fn epee_default_value() -> Option<Self>
fn epee_default_value() -> Option<Self>
fn write<B: BufMut>(self, w: &mut B) -> Result<()>
source§impl Ord for Status
impl Ord for Status
source§impl PartialEq for Status
impl PartialEq for Status
source§impl PartialOrd for Status
impl PartialOrd for Status
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self and other) and is used by the <=
operator. Read moreimpl Copy for Status
impl Eq for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
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
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 1 byte
Size for each variant:
Ok: 0 bytesBusy: 0 bytesNotMining: 0 bytesPaymentRequired: 0 bytesUnknown: 0 bytes