Skip to main content

EndpointMetaStatic

Struct EndpointMetaStatic 

Source
pub struct EndpointMetaStatic {
    pub name: &'static str,
    pub path: &'static str,
    pub protocol: Protocol,
    pub description: Option<&'static str>,
    pub method: Option<&'static str>,
    pub tags: &'static [&'static str],
    pub request_schema_fn: Option<fn() -> Value>,
    pub response_schema_fn: Option<fn() -> Value>,
}
Expand description

Static-lifetime version of EndpointMeta used for compile-time registration via the inventory crate.

Proc-macro generated code emits inventory::submit! blocks containing this type (all fields are &'static str, which is const-constructible). At runtime, EndpointMetaStatic::into_endpoint_meta converts each entry into a heap-allocated EndpointMeta.

Fields§

§name: &'static str

Display name of the endpoint.

§path: &'static str

URL path or MQTT topic string.

§protocol: Protocol

Transport protocol.

§description: Option<&'static str>

Optional human-readable description.

§method: Option<&'static str>

HTTP verb, if applicable.

§tags: &'static [&'static str]

Tags for grouping, as a static string slice.

§request_schema_fn: Option<fn() -> Value>

Called once at startup to generate the request JSON Schema. None for endpoints with no request body.

§response_schema_fn: Option<fn() -> Value>

Called once at startup to generate the response JSON Schema. None for endpoints with no response schema.

Implementations§

Source§

impl EndpointMetaStatic

Source

pub fn into_endpoint_meta(&self) -> EndpointMeta

Converts the static reference into an owned EndpointMeta.

Trait Implementations§

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 = 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.