Crate matrix_sdk[][src]

Expand description

This crate implements a Matrix client library.

Enabling logging

Users of the matrix-sdk crate can enable log output by depending on the tracing-subscriber crate and including the following line in their application (e.g. at the start of main):

tracing_subscriber::fmt::init();

The log output is controlled via the RUST_LOG environment variable by setting it to one of the error, warn, info, debug or trace levels. The output is printed to stdout.

The RUST_LOG variable also supports a more advanced syntax for filtering log output more precisely, for instance with crate-level granularity. For more information on this, check out the tracing_subscriber documentation.

Crate Feature Flags

The following crate feature flags are available:

  • encryption: Enables end-to-end encryption support in the library.
  • sled_cryptostore: Enables a Sled based store for the encryption keys. If this is disabled and encryption support is enabled the keys will by default be stored only in memory and thus lost after the client is destroyed.
  • markdown: Support for sending markdown formatted messages.
  • socks: Enables SOCKS support in reqwest, the default HTTP client.
  • sso_login: Enables SSO login with a local http server.
  • require_auth_for_profile_requests: Whether to send the access token in the authentication header when calling endpoints that retrieve profile data. This matches the synapse configuration require_auth_for_profile_requests. Enabled by default.
  • appservice: Enables low-level appservice functionality. For an high-level API there’s the matrix-sdk-appservice crate

Re-exports

pub use reqwest;
pub use ruma::api::client as api;
pub use ruma::events;
pub use ruma::identifiers;

Modules

deserialized_responses
directory

Common types for room directory endpoints.

encryption

Common types for encryption related tasks.

executor

Abstraction over an executor so we can spawn tasks under WASM the same way we do usually.

instant
locks
media

Common types for media content.

presence

Common types for the presence module.

push

Common types for the push notifications module.

receipt

Common types for receipts.

room

High-level room API

thirdparty

Common types for the third party networks module.

uuid

Generate and parse UUIDs.

verification

Interactive verification for E2EE capable users and devices in Matrix.

Macros

assign

Mutate a struct value in a declarative style.

int

Creates an Int from a numeric literal.

uint

Creates a UInt from a numeric literal.

Structs

BaseRoom

The underlying room data structure collecting state for joined, left and invited rooms.

BaseRoomMember

A member of a room.

Bytes

A cheaply cloneable and sliceable chunk of contiguous memory.

BytesMut

A unique reference to a contiguous slice of memory.

Client

An async/await enabled Matrix client.

ClientConfig

Configuration for the creation of the Client.

Device

A device represents a E2EE capable client of an user.

EncryptionInfoencryption

Struct holding all the information that is needed to decrypt an encrypted file.

Int

An integer limited to the range of integers that can be represented exactly by an f64.

MatrixError

A general-purpose Matrix error type consisting of an HTTP status code and a JSON body.

MilliSecondsSinceUnixEpoch

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

Raw

A wrapper around Box<RawValue>, to be used in place of any type in the Matrix endpoint definition to allow request and response types to contain that said type represented by the generic argument Ev.

RequestConfig

Configuration for requests the Client makes.

RoomInfo

The underlying pure data structure for joined and left rooms.

RoomMember

The high-level RoomMember representation

SecondsSinceUnixEpoch

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

Session

A user session, containing an access token and information about the associated user account.

StateChanges

Store state changes and pass them to the StateStore.

SyncSettings

Settings for a sync call.

UInt

An integer limited to the range of non-negative integers that can be represented exactly by an f64.

Enums

AuthScheme

Authentication scheme used by the endpoint.

BaseError

Internal representation of errors.

CanonicalJsonValue

Represents a canonical JSON value as per the Matrix specification.

CustomEvent

This represents the various “unrecognized” events.

Error

Internal representation of errors.

FromHttpRequestError

An error when converting a http request to one of ruma’s endpoint-specific request types.

FromHttpResponseError

An error when converting a http response to one of Ruma’s endpoint-specific response types.

HttpError

An HTTP error, representing either a connection error or an error while converting the raw HTTP response into a Matrix response.

IntoHttpError

An error when converting one of ruma’s endpoint-specific request or response types to the corresponding http type.

LocalTrustencryption

The local trust state of a device.

LoopCtrl

Enum controlling if a loop running callbacks should continue or abort.

RoomType

Enum keeping track in which state the room is, e.g. if our own user is joined, invited, or has left the room.

SendAccessToken

An enum to control whether an access token should be added to outgoing requests

ServerError

An error was reported by the server (HTTP status code 4xx or 5xx)

StoreError

State store specific error type.

Traits

AsyncTraitDeps

Super trait that is used for our store traits, this trait will differ if it’s used on WASM. WASM targets will not require Send and Sync to have implemented, while other targets will.

EndpointError

Gives users the ability to define their own serializable / deserializable errors.

EventHandler

This trait allows any type implementing EventHandler to specify event callbacks for each event. The Client calls each method when the corresponding event is received.

HttpSend

Abstraction around the http layer. The allows implementors to use different http libraries.

IncomingResponse

A response type for a Matrix API endpoint, used for receiving responses.

Outgoing

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

OutgoingRequest

A request type for a Matrix API endpoint, used for sending requests.

Type Definitions

Result

Result type of the rust-sdk.

Attribute Macros

async_trait

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: