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: SchemaRefSchema of the request parameters (one row).
result_schema: SchemaRefSchema 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: boolWhether 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
impl MethodInfo
Sourcepub fn unary(
name: impl Into<String>,
params_schema: SchemaRef,
result_schema: SchemaRef,
handler: impl Fn(&Request, &CallContext) -> Result<Option<RecordBatch>> + Send + Sync + 'static,
) -> Self
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.
Sourcepub fn stream(
name: impl Into<String>,
method_type: MethodType,
params_schema: SchemaRef,
handler: impl Fn(&Request, &CallContext) -> Result<StreamResult> + Send + Sync + 'static,
) -> Self
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.
Sourcepub fn with_state_decoder(self, decoder: StateDecoder) -> Self
pub fn with_state_decoder(self, decoder: StateDecoder) -> Self
Attach a state decoder function. See StateDecoder.