Skip to main content

RpcStatus

Enum RpcStatus 

Source
#[repr(u16)]
pub enum RpcStatus { Ok = 0, NotFound = 1, Unauthorized = 2, Timeout = 3, Backpressure = 4, Cancelled = 5, Internal = 6, UnknownVersion = 7, CapabilityDenied = 8, Application(u16), }
Expand description

Outcome of an nRPC call. Net-native numbering with documented gRPC equivalents (see comments). Numeric stability: callers and servers across versions agree on 0x0000..=0x7FFF; the application-defined range is 0x8000..=0xFFFF.

Variants§

§

Ok = 0

Success. Payload carries the application response. Terminal (or, for streaming responses, may be one of many — see the streaming flag). gRPC equivalent: OK (0).

§

NotFound = 1

No service registered with the requested name on the server. gRPC equivalent: NOT_FOUND (5).

§

Unauthorized = 2

Caller’s token doesn’t list the requested service in scope, or the channel-level capability check failed. gRPC equivalent: PERMISSION_DENIED (7).

§

Timeout = 3

Server observed now_ns() > deadline_ns before starting work. (For the in-flight case after the handler started, see DISPATCH_RPC_DEADLINE_EXCEEDED.) gRPC equivalent: DEADLINE_EXCEEDED (4).

§

Backpressure = 4

Server’s per-service queue is at max_in_flight capacity. gRPC equivalent: RESOURCE_EXHAUSTED (8).

§

Cancelled = 5

Caller emitted DISPATCH_RPC_CANCEL before the server completed. gRPC equivalent: CANCELLED (1).

§

Internal = 6

Handler panicked or returned an error not classified as one of the above. Payload carries a UTF-8 diagnostic. gRPC equivalent: INTERNAL (13).

§

UnknownVersion = 7

Request payload version not supported by the server. Should normally be caught earlier by subprotocol-version negotiation; the in-payload guard is the floor. gRPC equivalent: UNIMPLEMENTED (12).

§

CapabilityDenied = 8

v0.4 capability-auth: the target’s CapabilityAnnouncement either does not list the requested nrpc:<service> tag, or lists it with allow-lists the caller does not match. See docs/plans/CAPABILITY_AUTH_PLAN.md §3. Distinct from Unauthorized (channel-auth / token-scope failures) so operators can tell the two enforcement surfaces apart in audit logs. gRPC equivalent: PERMISSION_DENIED (7) — same outward shape as Unauthorized but a separate substrate code.

§

Application(u16)

Application-defined status. The wire carries the raw u16; callers / servers agree on the meaning out of band.

Implementations§

Source§

impl RpcStatus

Source

pub fn to_wire(self) -> u16

Encode to the wire u16.

Source

pub fn from_wire(v: u16) -> Self

Decode from the wire u16. Reserved values (0x0009..=0x7FFF) decode as Application(v) rather than failing — forward-compat with future status assignments.

Source

pub fn is_ok(self) -> bool

True iff self == Ok. Convenience for the hot caller-side success-or-error branch.

Trait Implementations§

Source§

impl Clone for RpcStatus

Source§

fn clone(&self) -> RpcStatus

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RpcStatus

Source§

impl Debug for RpcStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for RpcStatus

Source§

impl PartialEq for RpcStatus

Source§

fn eq(&self, other: &RpcStatus) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RpcStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more