[][src]Crate ruma_api

Crate ruma_api contains core types used to define the requests and responses for each endpoint in the various Matrix API specifications. These types can be shared by client and server code for all Matrix APIs.

When implementing a new Matrix API, each endpoint has a request type which implements Endpoint, and a response type connected via an associated type.

An implementation of Endpoint contains all the information about the HTTP method, the path and input parameters for requests, and the structure of a successful response. Such types can then be used by client code to make requests, and by server code to fulfill those requests.

Macros

ruma_api

Generates a ruma_api::Endpoint from a concise definition.

Structs

Error

An error when converting an Endpoint request or response to the corresponding type from the http crate.

Metadata

Metadata about an API endpoint.

Traits

Endpoint

A Matrix API endpoint.

Outgoing

A type that can be sent to another party that understands the matrix protocol. If any of the fields of Self don't implement serde's Deserialize, you can derive this trait to generate a corresponding 'Incoming' type that supports deserialization. This is useful for things like ruma_events' EventResult type. For more details, see the derive macro's documentation.

Derive Macros

Outgoing

Derive the Outgoing trait, possibly generating an 'Incoming' version of the struct this derive macro is used on. Specifically, if no #[wrap_incoming] attribute is used on any of the fields of the struct, this simple implementation will be generated: