Crate ruma[][src]

Expand description

Types and traits for working with the Matrix protocol.

This crate re-exports things from all of the other ruma crates so you don’t have to manually keep all the versions in sync.

Which crates are re-exported can be configured through cargo features.

⚠ Some details might be missing because rustdoc has trouble with re-exports so you may need to refer to other crates’ documentations.

API features

Depending on which parts of Matrix are relevant to you, activate the following features:

  • appservice-api – Application Service API.
  • client-api – Client-Server API.
  • federation-api – Server-Server (Federation) API.
  • identity-service-api – Identity Service API.
  • push-gateway-api – Push Gateway API.

These features have client- and server-optimized variants that are enabled respectively with the -c and -s suffixes. For example:

  • client-api-c – The Client-Server API optimized for the client side.
  • client-api-s – The Client-Server API optimized for the server side.

Compatibility feature

  • compat increases compatibility with other parts of the Matrix ecosystem, at the expense of deviating from the specification.

Convenience features

These features are only useful if you want to use a method that requires it:

  • either
  • rand
  • markdown

Unstable features

By using these features, you opt out of all semver guarantees Ruma otherwise provides:

  • unstable-exhaustive-types – Most types in Ruma are marked as non-exhaustive to avoid breaking changes when new fields are added in the specification. This feature compiles all types as exhaustive.
  • unstable-pre-spec – Upcoming Matrix features that may be subject to change or removal.

Common features

These submodules are usually activated by the API features when needed:

  • api
  • events
  • signatures

If you are viewing this on docs.rs, you can have a look at the feature dependencies by clicking Feature flags in the toolbar at the top.

Re-exports

pub use assign::assign;
pub use js_int::int;
pub use js_int::uint;
pub use js_int::Int;
pub use js_int::UInt;

Modules

apiapi

(De)serializable types for various Matrix APIs requests and responses and abstractions for them.

authentication

Common types for authentication.

clientclient

A minimal Matrix client library.

directory

Common types for room directory endpoints.

encryption

Common types for encryption related tasks.

eventsevents

(De)serializable types for the events in the Matrix specification. These types are used by other ruma crates.

identifiers

Types for Matrix identifiers for devices, events, keys, rooms, servers, users and URIs.

power_levels

Common types for the m.room.power_levels event.

presence

Common types for the presence module.

push

Common types for the push notifications module.

receipt

Common types for receipts.

serde

(De)serialization helpers for other ruma crates.

signaturessignatures

Digital signatures according to the Matrix specification.

state_resstate-res
thirdparty

Common types for the third party networks module.

user_id

Matrix user identifiers.

Macros

device_id

Shorthand for Box::<DeviceId>::from.

device_key_id

Compile-time checked DeviceKeyId construction.

event_id

Compile-time checked EventId construction.

mxc_uri

Compile-time checked MxcUri construction.

room_alias_id

Compile-time checked RoomAliasId construction.

room_id

Compile-time checked RoomId construction.

room_version_id

Compile-time checked RoomVersionId construction.

server_key_idDeprecated

Compile-time checked ServerSigningKeyId construction.

server_name

Compile-time checked ServerName construction.

server_signing_key_id

Compile-time checked ServerSigningKeyId construction.

user_id

Compile-time checked UserId construction.

Structs

DeviceId

A Matrix key ID.

DeviceKeyId

A key algorithm and a device id, combined with a ‘:’.

EventId

A Matrix event ID.

KeyId

A key algorithm and key name delimited by a colon

KeyName

A Matrix key identifier.

MilliSecondsSinceUnixEpoch

A timestamp represented as the number of milliseconds since the unix epoch.

MxcUri

A URI that should be a Matrix-spec compliant MXC URI.

RoomAliasId

A Matrix room alias ID.

RoomId

A Matrix room ID.

RoomIdOrAliasId

A Matrix room ID or a Matrix room alias ID.

SecondsSinceUnixEpoch

A timestamp represented as the number of seconds since the unix epoch.

ServerName

A Matrix-spec compliant server name.

Signatures

Map of all signatures, grouped by entity

UserId

A Matrix user ID.

Enums

DeviceKeyAlgorithm

The basic key algorithms in the specification.

EventEncryptionAlgorithm

An encryption algorithm to be used to encrypt messages sent to a room.

RoomVersionId

A Matrix room version ID.

SigningKeyAlgorithm

The signing key algorithms defined in the Matrix spec.

Traits

Outgoing

A type that can be sent to another party that understands the matrix protocol.

Type Definitions

DeviceIdBox

An owned DeviceId.

DeviceSignatures

Map of device signatures for an event, grouped by user.

DeviceSigningKeyId

Algorithm + key name for device keys.

EntitySignatures

Map of key identifier to signature values.

KeyNameBox

An owned KeyName.

ServerNameBox

An owned server name.

ServerSignatures

Map of server signatures for an event, grouped by server.

ServerSigningKeyId

Algorithm + key name for homeserver signing keys.

Derive Macros

Outgoing

Derive the Outgoing trait, possibly generating an ‘Incoming’ version of the struct this derive macro is used on. Specifically, if no lifetime variables are used on any of the fields of the struct, this simple implementation will be generated: