#[non_exhaustive]pub struct MethodDescriptor {
pub kind: MethodKind,
pub idempotent: bool,
pub spec: Option<Spec>,
}Expand description
Description of a method returned by Dispatcher::lookup.
Carries only enough information to select the correct body-processing
path in handle_request; the actual handler invocation happens in a
separate call_* step.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.kind: MethodKindThe kind of RPC method.
idempotent: boolWhether the method has no side effects and is eligible for Connect GET.
Only meaningful for MethodKind::Unary. Always false for streaming.
This is a narrower flag than Spec::idempotency_level:
it is true only for IdempotencyLevel::NoSideEffects. Methods
declared Idempotent (safe to retry but side-effecting) report
idempotent == false here while carrying the full level in spec.
spec: Option<Spec>Static method metadata, when known.
Code-generated dispatchers always supply a Spec; the dynamic
Router returns None because its method paths
are owned Strings and Spec::procedure requires &'static str.
Implementations§
Source§impl MethodDescriptor
impl MethodDescriptor
Sourcepub const fn server_streaming() -> Self
pub const fn server_streaming() -> Self
Convenience constructor for server-streaming methods.
Sourcepub const fn client_streaming() -> Self
pub const fn client_streaming() -> Self
Convenience constructor for client-streaming methods.
Sourcepub const fn bidi_streaming() -> Self
pub const fn bidi_streaming() -> Self
Convenience constructor for bidirectional streaming methods.
Sourcepub const fn from_kind(kind: MethodKind) -> Self
pub const fn from_kind(kind: MethodKind) -> Self
Construct a descriptor for the given MethodKind with default
idempotent (false) and no Spec.
Sourcepub const fn with_idempotent(self, idempotent: bool) -> Self
pub const fn with_idempotent(self, idempotent: bool) -> Self
Set the idempotency flag. Returns self for chaining.
Sourcepub const fn with_spec(self, spec: Spec) -> Self
pub const fn with_spec(self, spec: Spec) -> Self
Attach a Spec. Returns self for chaining.
Generated dispatchers call this so RequestContext::spec is
populated for handlers and interceptors.
Trait Implementations§
Source§impl Clone for MethodDescriptor
impl Clone for MethodDescriptor
Source§fn clone(&self) -> MethodDescriptor
fn clone(&self) -> MethodDescriptor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MethodDescriptor
Source§impl Debug for MethodDescriptor
impl Debug for MethodDescriptor
impl Eq for MethodDescriptor
Source§impl PartialEq for MethodDescriptor
impl PartialEq for MethodDescriptor
impl StructuralPartialEq for MethodDescriptor
Auto Trait Implementations§
impl Freeze for MethodDescriptor
impl RefUnwindSafe for MethodDescriptor
impl Send for MethodDescriptor
impl Sync for MethodDescriptor
impl Unpin for MethodDescriptor
impl UnsafeUnpin for MethodDescriptor
impl UnwindSafe for MethodDescriptor
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: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.