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.
🛈 For internal consistency, Ruma uses American spelling for variable names. Names may differ in the serialized representation, as the Matrix specification has a mix of British and American English.
§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:
rand
– Generate random identifiers.markdown
– Parse markdown to construct messages.html
– Parse HTML to sanitize it or navigate its tree.html-matrix
– Enables thematrix
feature ofruma-html
to parse HTML elements data to typed data as suggested by the Matrix Specification.
§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-mscXXXX
, whereXXXX
is the MSC number – Upcoming Matrix features that may be subject to change or removal.unstable-unspecified
– Undocumented 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
§ruma-client
features
The client
feature activates [ruma::client
][client], and client-ext-client-api
activates
ruma-client
s client-api
feature. All other client-*
features activate the same feature
without the client-
prefix on ruma-client
. See the crate’s documentation for the effect of
these features.
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;
pub use js_option::JsOption;
pub use web_time as time;
Modules§
- api
api
(De)serializable types for various Matrix APIs requests and responses and abstractions for them. - Common types for authentication.
- canonical_
json canonical-json
Canonical JSON types and related functions. - Common types for room directory endpoints.
- Common types for encryption related tasks.
- events
events
(De)serializable types for the events in the Matrix specification. These types are used by other Ruma crates. - html
html
Opinionated HTML parsing and manipulating library. - Helpers for HTTP headers.
- Matrix URIs.
- Common types and functions for the content repository.
- Common types for the
m.room.power_levels
event. - Common types for the presence module.
- Common types for the push notifications module.
- Common types for rooms.
- (De)serialization helpers for other Ruma crates.
- Common types for spaces.
- Common types for the third party networks module.
- Common types for the Send-To-Device Messaging
- Matrix user identifiers.
Macros§
- Shorthand for
<&DeviceId>::from
. - Compile-time checked
DeviceKeyId
construction. - Compile-time checked
EventId
construction. - Convenient constructor for
Metadata
constants. - Compile-time checked
MxcUri
construction. - Shorthand for
OwnedDeviceId::from
. - Compile-time checked
OwnedDeviceKeyId
construction. - Compile-time checked
OwnedEventId
construction. - Compile-time checked
OwnedMxcUri
construction. - Compile-time checked
OwnedRoomAliasId
construction. - Compile-time checked
OwnedRoomId
construction. - Compile-time checked
OwnedServerName
construction. - Compile-time checked
OwnedServerSigningKeyId
construction. - Compile-time checked
OwnedSessionId
construction. - Compile-time checked
OwnedUserId
construction. - Compile-time checked
RoomAliasId
construction. - Compile-time checked
RoomId
construction. - Compile-time checked
RoomVersionId
construction. - Compile-time checked
ServerName
construction. - Compile-time checked
ServerSigningKeyId
construction. - Compile-time checked
SessionId
construction. - Compile-time checked
UserId
construction.
Structs§
- A client secret.
- A Matrix key ID.
- A key algorithm and a device id, combined with a ‘:’.
- A Matrix event ID.
- A key algorithm and key name delimited by a colon.
- A Matrix key identifier.
- The
matrix.to
URI representation of a user, room or event. - The
matrix:
URI representation of a user, room or event. - A timestamp represented as the number of milliseconds since the unix epoch.
- A URI that should be a Matrix-spec compliant MXC URI.
- Owned variant of ClientSecret
- Owned variant of DeviceId
- Owned variant of DeviceKeyId
- Owned variant of EventId
- Owned variant of KeyId
- Owned variant of KeyName
- Owned variant of MxcUri
- Owned variant of RoomAliasId
- Owned variant of RoomId
- Owned variant of RoomOrAliasId
- Owned variant of ServerName
- Owned variant of SessionId
- Owned variant of TransactionId
- Owned variant of UserId
- Owned variant of VoipId
- A Matrix room alias ID.
- A Matrix room ID.
- A Matrix room ID or a Matrix room alias ID.
- A timestamp represented as the number of seconds since the unix epoch.
- A Matrix-spec compliant server name.
- A session ID.
- Map of all signatures, grouped by entity
- A Matrix transaction ID.
- A Matrix user ID.
- A VoIP identifier.
Enums§
- Canonical
Json Error canonical-json
The set of possible errors when serializing to canonical JSON. - Canonical
Json Value canonical-json
Represents a canonical JSON value as per the Matrix specification. - The basic key algorithms in the specification.
- An encryption algorithm to be used to encrypt messages sent to a room.
- An error encountered when trying to parse an invalid ID string.
- A key algorithm to be used to generate a key from a passphrase.
- An error occurred while validating a
MatrixId
. - An error occurred while validating a
matrix.to
URI. - An error occurred while validating a
MatrixURI
. - An error occurred while validating an MXC URI.
- A Matrix room version ID.
- The signing key algorithms defined in the Matrix spec.
- A Matrix VoIP version ID.
- An error occurred while validating a
VoipVersionId
.
Type Aliases§
- Canonical
Json Object canonical-json
The inner type ofCanonicalJsonValue::Object
. - Map of device signatures for an event, grouped by user.
- Algorithm + key name for device keys.
- Map of key identifier to signature values.
- Algorithm + key name for device keys.
- Algorithm + key name for homeserver signing keys.
- Algorithm + key name for signing keys.
- Map of server signatures for an event, grouped by server.
- Algorithm + key name for homeserver signing keys.
- Algorithm + key name for signing keys.