pub enum Status {
Ok,
Failed,
Busy,
NotMining,
PaymentRequired,
Other(Cow<'static, str>),
}Expand description
RPC response status.
This type represents monerod’s frequently appearing string field, status.
§Serialization and string formatting
use cuprate_rpc_types::{
misc::Status,
CORE_RPC_STATUS_BUSY, CORE_RPC_STATUS_NOT_MINING, CORE_RPC_STATUS_OK,
CORE_RPC_STATUS_PAYMENT_REQUIRED, CORE_RPC_STATUS_FAILED
};
use serde_json::{to_string, from_str};
let other = Status::Other("OTHER".into());
assert_eq!(to_string(&Status::Ok).unwrap(), r#""OK""#);
assert_eq!(to_string(&Status::Failed).unwrap(), r#""Failed""#);
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(&other).unwrap(), r#""OTHER""#);
assert_eq!(from_str::<Status>(r#""Ok""#).unwrap(), Status::Ok);
assert_eq!(from_str::<Status>(r#""OK""#).unwrap(), Status::Ok);
assert_eq!(from_str::<Status>(r#""Failed""#).unwrap(), Status::Failed);
assert_eq!(from_str::<Status>(r#""FAILED""#).unwrap(), Status::Failed);
assert_eq!(from_str::<Status>(r#""Busy""#).unwrap(), Status::Busy);
assert_eq!(from_str::<Status>(r#""BUSY""#).unwrap(), Status::Busy);
assert_eq!(from_str::<Status>(r#""NOT MINING""#).unwrap(), Status::NotMining);
assert_eq!(from_str::<Status>(r#""PAYMENT REQUIRED""#).unwrap(), Status::PaymentRequired);
assert_eq!(from_str::<Status>(r#""OTHER""#).unwrap(), other);
assert_eq!(Status::Ok.as_ref(), CORE_RPC_STATUS_OK);
assert_eq!(Status::Failed.as_ref(), CORE_RPC_STATUS_FAILED);
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!(other.as_ref(), "OTHER");
assert_eq!(format!("{}", Status::Ok), CORE_RPC_STATUS_OK);
assert_eq!(format!("{}", Status::Failed), CORE_RPC_STATUS_FAILED);
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!("{}", other), "OTHER");
assert_eq!(format!("{:?}", Status::Ok), "Ok");
assert_eq!(format!("{:?}", Status::Failed), "Failed");
assert_eq!(format!("{:?}", Status::Busy), "Busy");
assert_eq!(format!("{:?}", Status::NotMining), "NotMining");
assert_eq!(format!("{:?}", Status::PaymentRequired), "PaymentRequired");
assert_eq!(format!("{:?}", other), r#"Other("OTHER")"#);Variants§
Ok
Successful RPC response, everything is OK; CORE_RPC_STATUS_OK.
Failed
Generic request failure.
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.
Other(Cow<'static, str>)
Some unknown other string.
This exists to act as a catch-all for all of
monerod’s other strings it puts in the status field.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Status
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Status
serde only.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
Available on crate feature epee only.
impl EpeeValue for Status
epee only.const MARKER: Marker = <String as EpeeValue>::MARKER
fn read<B: Buf>( r: &mut B, marker: &Marker, limits: EpeeValueLimits, ) -> 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<()>
impl Eq for Status
Source§impl Ord for Status
impl Ord for Status
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Status
impl PartialOrd 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 UnsafeUnpin 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
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,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘwhere
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
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: 24 bytes
Size for each variant:
Ok: 0 bytesFailed: 0 bytesBusy: 0 bytesNotMining: 0 bytesPaymentRequired: 0 bytesOther: 24 bytes