Skip to main content

HandlerSignature

Struct HandlerSignature 

Source
pub struct HandlerSignature {
    pub fn_name: String,
    pub fn_span: Span,
    pub state_type: Option<Type>,
    pub input_type: Option<Type>,
    pub query_type: Option<Type>,
    pub path_params: Vec<(String, Type)>,
    pub output_type: Type,
    pub error_type: Option<Type>,
    pub is_streaming: bool,
    pub is_async: bool,
}
Expand description

Fully analysed handler function signature.

Produced by extract_handler_signature. All fields are resolved against the actual AST — no string-based type inference.

Fields§

§fn_name: String

The function’s identifier, e.g. "list_planets".

§fn_span: Span

Span of the function identifier for error reporting.

§state_type: Option<Type>

The S in a State<S> parameter, if present.

§input_type: Option<Type>

The T in a Json<T> parameter, if present.

§query_type: Option<Type>

The T in a Query<T> parameter, if present.

§path_params: Vec<(String, Type)>

Ordered list of (binding_name, rust_type) pairs from Path<T> parameters.

E.g., Path(id): Path<i32>[("id", Type::i32)] Multiple params: Path(id): Path<i32>, Path(slug): Path<String>[("id", i32), ("slug", String)]

§output_type: Type

The resolved output type:

  • Json<T> return → T
  • Result<Json<T>, E> return → T
  • Sse<...> return → unit () (output type comes from data attribute)
§error_type: Option<Type>

The E in Result<_, E>, if present.

§is_streaming: bool

Whether the handler returns Sse<...> (an SSE streaming response).

§is_async: bool

Whether the function is declared async.

Trait Implementations§

Source§

impl Debug for HandlerSignature

Source§

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

Formats the value using the given formatter. Read more

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.