Skip to main content

MethodInfo

Struct MethodInfo 

Source
pub struct MethodInfo {
Show 13 fields pub name: String, pub method_type: MethodType, pub params_schema: SchemaRef, pub result_schema: SchemaRef, pub header_schema: Option<SchemaRef>, pub doc: Option<String>, pub param_types: Vec<(String, String)>, pub param_defaults: Vec<(String, Value)>, pub param_docs: Vec<(String, String)>, pub has_return: bool, pub unary: Option<UnaryHandler>, pub stream: Option<StreamHandler>, pub state_decoder: Option<StateDecoder>,
}
Expand description

Describes one RPC method — the metadata required both for dispatch and introspection via __describe__.

Build via MethodInfo::unary / MethodInfo::stream and attach additional describe-time metadata through the builder helpers (.doc, .param_type, .param_default, .param_doc, .header_schema).

Fields§

§name: String§method_type: MethodType§params_schema: SchemaRef

Schema of the request parameters (one row).

§result_schema: SchemaRef

Schema of the unary result; empty for streams.

§header_schema: Option<SchemaRef>

For streams that emit a typed header, the header batch schema.

§doc: Option<String>

Method-level docstring (the first line of Python’s docstring).

§param_types: Vec<(String, String)>

Parameter type names in source order, matching the Python describe wire format (“str”, “int”, “liststr”, “Point”, “str | None”).

§param_defaults: Vec<(String, Value)>

Parameter defaults; values are anything JSON-serializable.

§param_docs: Vec<(String, String)>

Per-parameter documentation (matches the Python param_docs_json).

§has_return: bool

Whether the method has a non-void return. false for streams/void.

§unary: Option<UnaryHandler>§stream: Option<StreamHandler>§state_decoder: Option<StateDecoder>

Decoder that reconstructs the method’s StreamStateKind from a byte slice produced by ProducerState::encode_state / ExchangeState::encode_state. Required for HTTP streaming (the stateless-worker model); None for unary methods and for streams that will only ever run over pipe/unix.

Implementations§

Source§

impl MethodInfo

Source

pub fn unary( name: impl Into<String>, params_schema: SchemaRef, result_schema: SchemaRef, handler: impl Fn(&Request, &CallContext) -> Result<Option<RecordBatch>> + Send + Sync + 'static, ) -> Self

Start building a unary method registration.

Source

pub fn stream( name: impl Into<String>, method_type: MethodType, params_schema: SchemaRef, handler: impl Fn(&Request, &CallContext) -> Result<StreamResult> + Send + Sync + 'static, ) -> Self

Start building a streaming method registration.

Note: this form registers the method without a state decoder, so it will work for pipe/unix transports but HTTP continuation requests will fail. Use [MethodInfo::producer_with_codec] / [MethodInfo::exchange_with_codec] when HTTP is enabled.

Source

pub fn with_state_decoder(self, decoder: StateDecoder) -> Self

Attach a state decoder function. See StateDecoder.

Source

pub fn doc(self, s: impl Into<String>) -> Self

Source

pub fn param_type(self, param: impl Into<String>, ty: impl Into<String>) -> Self

Source

pub fn param_default(self, param: impl Into<String>, value: Value) -> Self

Source

pub fn param_doc(self, param: impl Into<String>, doc: impl Into<String>) -> Self

Source

pub fn header_schema(self, schema: SchemaRef) -> Self

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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