Rewrap comments
This commit is contained in:
parent
6c4bd7c72c
commit
e7f55ea2c6
@ -1,4 +1,6 @@
|
|||||||
|
comment_width = 100
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
merge_imports = true
|
merge_imports = true
|
||||||
newline_style = "Unix"
|
newline_style = "Unix"
|
||||||
use_small_heuristics = "Max"
|
use_small_heuristics = "Max"
|
||||||
|
wrap_comments = true
|
||||||
|
@ -53,48 +53,44 @@ use http::Method;
|
|||||||
///
|
///
|
||||||
/// This will generate a `ruma_api::Metadata` value to be used for the `ruma_api::Endpoint`'s
|
/// This will generate a `ruma_api::Metadata` value to be used for the `ruma_api::Endpoint`'s
|
||||||
/// associated constant, single `Request` and `Response` structs, and the necessary trait
|
/// associated constant, single `Request` and `Response` structs, and the necessary trait
|
||||||
/// implementations to convert the request into a `http::Request` and to create a response from a
|
/// implementations to convert the request into a `http::Request` and to create a response from
|
||||||
/// `http::Response` and vice versa.
|
/// a `http::Response` and vice versa.
|
||||||
///
|
///
|
||||||
/// The details of each of the three sections of the macros are documented below.
|
/// The details of each of the three sections of the macros are documented below.
|
||||||
///
|
///
|
||||||
/// ## Metadata
|
/// ## Metadata
|
||||||
///
|
///
|
||||||
/// * `description`: A short description of what the endpoint does.
|
/// * `description`: A short description of what the endpoint does.
|
||||||
/// * `method`: The HTTP method used for requests to the endpoint.
|
/// * `method`: The HTTP method used for requests to the endpoint. It's not necessary to import
|
||||||
/// It's not necessary to import `http::Method`'s associated constants. Just write
|
/// `http::Method`'s associated constants. Just write the value as if it was imported, e.g.
|
||||||
/// the value as if it was imported, e.g. `GET`.
|
/// `GET`.
|
||||||
/// * `name`: A unique name for the endpoint.
|
/// * `name`: A unique name for the endpoint. Generally this will be the same as the containing
|
||||||
/// Generally this will be the same as the containing module.
|
/// module.
|
||||||
/// * `path`: The path component of the URL for the endpoint, e.g. "/foo/bar".
|
/// * `path`: The path component of the URL for the endpoint, e.g. "/foo/bar". Components of
|
||||||
/// Components of the path that are parameterized can indicate a varible by using a Rust
|
/// the path that are parameterized can indicate a varible by using a Rust identifier
|
||||||
/// identifier prefixed with a colon, e.g. `/foo/:some_parameter`.
|
/// prefixed with a colon, e.g. `/foo/:some_parameter`. A corresponding query string
|
||||||
/// A corresponding query string parameter will be expected in the request struct (see below
|
/// parameter will be expected in the request struct (see below for details).
|
||||||
/// for details).
|
/// * `rate_limited`: Whether or not the endpoint enforces rate limiting on requests.
|
||||||
/// * `rate_limited`: Whether or not the endpoint enforces rate limiting on requests.
|
/// * `authentication`: What authentication scheme the endpoint uses.
|
||||||
/// * `authentication`: What authentication scheme the endpoint uses.
|
|
||||||
///
|
///
|
||||||
/// ## Request
|
/// ## Request
|
||||||
///
|
///
|
||||||
/// The request block contains normal struct field definitions.
|
/// The request block contains normal struct field definitions.
|
||||||
/// Doc comments and attributes are allowed as normal.
|
/// Doc comments and attributes are allowed as normal.
|
||||||
/// There are also a few special attributes available to control how the struct is converted into a
|
/// There are also a few special attributes available to control how the struct is converted
|
||||||
/// `http::Request`:
|
/// into a `http::Request`:
|
||||||
///
|
///
|
||||||
/// * `#[ruma_api(header = HEADER_NAME)]`: Fields with this attribute will be treated as HTTP
|
/// * `#[ruma_api(header = HEADER_NAME)]`: Fields with this attribute will be treated as HTTP
|
||||||
/// headers on the request.
|
/// headers on the request. The value must implement `AsRef<str>`. Generally this is a
|
||||||
/// The value must implement `AsRef<str>`.
|
/// `String`. The attribute value shown above as `HEADER_NAME` must be a header name constant
|
||||||
/// Generally this is a `String`.
|
/// from `http::header`, e.g. `CONTENT_TYPE`.
|
||||||
/// The attribute value shown above as `HEADER_NAME` must be a header name constant from
|
/// * `#[ruma_api(path)]`: Fields with this attribute will be inserted into the matching path
|
||||||
/// `http::header`, e.g. `CONTENT_TYPE`.
|
/// component of the request URL.
|
||||||
/// * `#[ruma_api(path)]`: Fields with this attribute will be inserted into the matching path
|
/// * `#[ruma_api(query)]`: Fields with this attribute will be inserting into the URL's query
|
||||||
/// component of the request URL.
|
/// string.
|
||||||
/// * `#[ruma_api(query)]`: Fields with this attribute will be inserting into the URL's query
|
/// * `#[ruma_api(query_map)]`: Instead of individual query fields, one query_map field, of any
|
||||||
/// string.
|
/// type that implements `IntoIterator<Item = (String, String)>` (e.g. `HashMap<String,
|
||||||
/// * `#[ruma_api(query_map)]`: Instead of individual query fields, one query_map field, of any
|
/// String>`, can be used for cases where an endpoint supports arbitrary query parameters.
|
||||||
/// type that implements `IntoIterator<Item = (String, String)>` (e.g.
|
|
||||||
/// `HashMap<String, String>`, can be used for cases where an endpoint supports arbitrary query
|
|
||||||
/// parameters.
|
|
||||||
///
|
///
|
||||||
/// Any field that does not include one of these attributes will be part of the request's JSON
|
/// Any field that does not include one of these attributes will be part of the request's JSON
|
||||||
/// body.
|
/// body.
|
||||||
@ -106,12 +102,10 @@ use http::Method;
|
|||||||
/// There is also a special attribute available to control how the struct is created from a
|
/// There is also a special attribute available to control how the struct is created from a
|
||||||
/// `http::Request`:
|
/// `http::Request`:
|
||||||
///
|
///
|
||||||
/// * `#[ruma_api(header = HEADER_NAME)]`: Fields with this attribute will be treated as HTTP
|
/// * `#[ruma_api(header = HEADER_NAME)]`: Fields with this attribute will be treated as HTTP
|
||||||
/// headers on the response.
|
/// headers on the response. The value must implement `AsRef<str>`. Generally this is a
|
||||||
/// The value must implement `AsRef<str>`.
|
/// `String`. The attribute value shown above as `HEADER_NAME` must be a header name constant
|
||||||
/// Generally this is a `String`.
|
/// from `http::header`, e.g. `CONTENT_TYPE`.
|
||||||
/// The attribute value shown above as `HEADER_NAME` must be a header name constant from
|
|
||||||
/// `http::header`, e.g. `CONTENT_TYPE`.
|
|
||||||
///
|
///
|
||||||
/// Any field that does not include the above attribute will be expected in the response's JSON
|
/// Any field that does not include the above attribute will be expected in the response's JSON
|
||||||
/// body.
|
/// body.
|
||||||
@ -119,15 +113,15 @@ use http::Method;
|
|||||||
/// ## Newtype bodies
|
/// ## Newtype bodies
|
||||||
///
|
///
|
||||||
/// Both the request and response block also support "newtype bodies" by using the
|
/// Both the request and response block also support "newtype bodies" by using the
|
||||||
/// `#[ruma_api(body)]` attribute on a field. If present on a field, the entire request or response
|
/// `#[ruma_api(body)]` attribute on a field. If present on a field, the entire request or
|
||||||
/// body will be treated as the value of the field. This allows you to treat the entire request or
|
/// response body will be treated as the value of the field. This allows you to treat the
|
||||||
/// response body as a specific type, rather than a JSON object with named fields. Only one field in
|
/// entire request or response body as a specific type, rather than a JSON object with named
|
||||||
/// each struct can be marked with this attribute. It is an error to have a newtype body field and
|
/// fields. Only one field in each struct can be marked with this attribute. It is an error to
|
||||||
/// normal body fields within the same struct.
|
/// have a newtype body field and normal body fields within the same struct.
|
||||||
///
|
///
|
||||||
/// There is another kind of newtype body that is enabled with `#[ruma_api(raw_body)]`. It is used
|
/// There is another kind of newtype body that is enabled with `#[ruma_api(raw_body)]`. It is
|
||||||
/// for endpoints in which the request or response body can be arbitrary bytes instead of a JSON
|
/// used for endpoints in which the request or response body can be arbitrary bytes instead of
|
||||||
/// objects. A field with `#[ruma_api(raw_body)]` needs to have the type `Vec<u8>`.
|
/// a JSON objects. A field with `#[ruma_api(raw_body)]` needs to have the type `Vec<u8>`.
|
||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
@ -201,10 +195,11 @@ use http::Method;
|
|||||||
///
|
///
|
||||||
/// ## Fallible deserialization
|
/// ## Fallible deserialization
|
||||||
///
|
///
|
||||||
/// All request and response types also derive [`Outgoing`][Outgoing]. As such, to allow fallible
|
/// All request and response types also derive [`Outgoing`][Outgoing]. As such, to allow
|
||||||
/// deserialization, you can use the `#[wrap_incoming]` attribute. For details, see the
|
/// fallible deserialization, you can use the `#[wrap_incoming]` attribute. For details, see
|
||||||
/// documentation for [the derive macro](derive.Outgoing.html).
|
/// the documentation for [the derive macro](derive.Outgoing.html).
|
||||||
// TODO: Explain the concept of fallible deserialization before jumping to `ruma_common::Outgoing`
|
// TODO: Explain the concept of fallible deserialization before jumping to
|
||||||
|
// `ruma_common::Outgoing`
|
||||||
pub use ruma_api_macros::ruma_api;
|
pub use ruma_api_macros::ruma_api;
|
||||||
|
|
||||||
pub mod error;
|
pub mod error;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
//! Endpoint to retrieve a list of Matrix portal rooms that lead to the matched third party location.
|
//! Endpoint to retrieve a list of Matrix portal rooms that lead to the matched third party
|
||||||
|
//! location.
|
||||||
|
|
||||||
pub mod v1;
|
pub mod v1;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
//! Endpoint to present clients with specific information about the various third party networks that an application service supports.
|
//! Endpoint to present clients with specific information about the various third party networks
|
||||||
|
//! that an application service supports.
|
||||||
|
|
||||||
pub mod v1;
|
pub mod v1;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
//! Endpoint to retrieve a Matrix User ID linked to a user on the third party network, given a set of user parameters.
|
//! Endpoint to retrieve a Matrix User ID linked to a user on the third party network, given a set
|
||||||
|
//! of user parameters.
|
||||||
|
|
||||||
pub mod v1;
|
pub mod v1;
|
||||||
|
@ -23,8 +23,8 @@ pub enum ErrorKind {
|
|||||||
|
|
||||||
/// M_UNKNOWN_TOKEN
|
/// M_UNKNOWN_TOKEN
|
||||||
UnknownToken {
|
UnknownToken {
|
||||||
/// If this is `true`, the client can acquire a new access token by specifying the device ID
|
/// If this is `true`, the client can acquire a new access token by specifying the device
|
||||||
/// it is already using to the login API. For more information, see [the spec].
|
/// ID it is already using to the login API. For more information, see [the spec].
|
||||||
///
|
///
|
||||||
/// [the spec]: https://matrix.org/docs/spec/client_server/r0.6.1#soft-logout
|
/// [the spec]: https://matrix.org/docs/spec/client_server/r0.6.1#soft-logout
|
||||||
soft_logout: bool,
|
soft_logout: bool,
|
||||||
|
@ -66,8 +66,8 @@ pub struct RoomEventFilter<'a> {
|
|||||||
|
|
||||||
/// A list of sender IDs to exclude.
|
/// A list of sender IDs to exclude.
|
||||||
///
|
///
|
||||||
/// If this list is absent then no senders are excluded. A matching sender will be excluded even
|
/// If this list is absent then no senders are excluded. A matching sender will be excluded
|
||||||
/// if it is listed in the 'senders' filter.
|
/// even if it is listed in the 'senders' filter.
|
||||||
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
||||||
pub not_senders: &'a [UserId],
|
pub not_senders: &'a [UserId],
|
||||||
|
|
||||||
@ -79,8 +79,8 @@ pub struct RoomEventFilter<'a> {
|
|||||||
|
|
||||||
/// A list of event types to include.
|
/// A list of event types to include.
|
||||||
///
|
///
|
||||||
/// If this list is absent then all event types are included. A '*' can be used as a wildcard to
|
/// If this list is absent then all event types are included. A '*' can be used as a wildcard
|
||||||
/// match any sequence of characters.
|
/// to match any sequence of characters.
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub types: Option<&'a [String]>,
|
pub types: Option<&'a [String]>,
|
||||||
|
|
||||||
@ -248,15 +248,15 @@ pub struct Filter<'a> {
|
|||||||
|
|
||||||
/// A list of event types to include.
|
/// A list of event types to include.
|
||||||
///
|
///
|
||||||
/// If this list is absent then all event types are included. A '*' can be used as a wildcard to
|
/// If this list is absent then all event types are included. A '*' can be used as a wildcard
|
||||||
/// match any sequence of characters.
|
/// to match any sequence of characters.
|
||||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||||
pub types: Option<&'a [String]>,
|
pub types: Option<&'a [String]>,
|
||||||
|
|
||||||
/// A list of sender IDs to exclude.
|
/// A list of sender IDs to exclude.
|
||||||
///
|
///
|
||||||
/// If this list is absent then no senders are excluded. A matching sender will be excluded even
|
/// If this list is absent then no senders are excluded. A matching sender will be excluded
|
||||||
/// if it is listed in the 'senders' filter.
|
/// even if it is listed in the 'senders' filter.
|
||||||
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
#[serde(default, skip_serializing_if = "<[_]>::is_empty")]
|
||||||
pub not_senders: &'a [UserId],
|
pub not_senders: &'a [UserId],
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,8 @@ impl Response {
|
|||||||
pub enum Filter<'a> {
|
pub enum Filter<'a> {
|
||||||
// The filter definition needs to be (de)serialized twice because it is a URL-encoded JSON
|
// The filter definition needs to be (de)serialized twice because it is a URL-encoded JSON
|
||||||
// string. Since #[ruma_api(query)] only does the latter and this is a very uncommon
|
// string. Since #[ruma_api(query)] only does the latter and this is a very uncommon
|
||||||
// setup, we implement it through custom serde logic for this specific enum variant rather than
|
// setup, we implement it through custom serde logic for this specific enum variant rather
|
||||||
// adding another ruma_api attribute.
|
// than adding another ruma_api attribute.
|
||||||
//
|
//
|
||||||
// On the deserialization side, because this is an enum with #[serde(untagged)], serde will
|
// On the deserialization side, because this is an enum with #[serde(untagged)], serde will
|
||||||
// try the variants in order (https://serde.rs/enum-representations.html). That means because
|
// try the variants in order (https://serde.rs/enum-representations.html). That means because
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! You can also pass an existing session to the `Client` constructor to restore a previous session
|
//! You can also pass an existing session to the `Client` constructor to restore a previous session
|
||||||
//! rather than calling `log_in`. This can also be used to create a session for an application service
|
//! rather than calling `log_in`. This can also be used to create a session for an application
|
||||||
//! that does not need to log in, but uses the access_token directly:
|
//! service that does not need to log in, but uses the access_token directly:
|
||||||
//!
|
//!
|
||||||
//! ```no_run
|
//! ```no_run
|
||||||
//! use ruma_client::{Client, Session};
|
//! use ruma_client::{Client, Session};
|
||||||
|
@ -12,8 +12,8 @@ pub struct Session {
|
|||||||
pub identification: Option<Identification>,
|
pub identification: Option<Identification>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The identification information about the associated user account if the session is associated with
|
/// The identification information about the associated user account if the session is associated
|
||||||
/// a single user account.
|
/// with a single user account.
|
||||||
#[derive(Clone, Debug, serde::Deserialize, Eq, Hash, PartialEq, serde::Serialize)]
|
#[derive(Clone, Debug, serde::Deserialize, Eq, Hash, PartialEq, serde::Serialize)]
|
||||||
pub struct Identification {
|
pub struct Identification {
|
||||||
/// The user the access token was issued for.
|
/// The user the access token was issued for.
|
||||||
|
@ -31,8 +31,8 @@ pub enum Action {
|
|||||||
pub enum Tweak {
|
pub enum Tweak {
|
||||||
/// A string representing the sound to be played when this notification arrives.
|
/// A string representing the sound to be played when this notification arrives.
|
||||||
///
|
///
|
||||||
/// A value of "default" means to play a default sound. A device may choose to alert the user by
|
/// A value of "default" means to play a default sound. A device may choose to alert the user
|
||||||
/// some other means if appropriate, eg. vibration.
|
/// by some other means if appropriate, eg. vibration.
|
||||||
Sound(String),
|
Sound(String),
|
||||||
|
|
||||||
/// A boolean representing whether or not this message should be highlighted in the UI.
|
/// A boolean representing whether or not this message should be highlighted in the UI.
|
||||||
@ -40,8 +40,8 @@ pub enum Tweak {
|
|||||||
/// This will normally take the form of presenting the message in a different color and/or
|
/// This will normally take the form of presenting the message in a different color and/or
|
||||||
/// style. The UI might also be adjusted to draw particular attention to the room in which the
|
/// style. The UI might also be adjusted to draw particular attention to the room in which the
|
||||||
/// event occurred. If a `highlight` tweak is given with no value, its value is defined to be
|
/// event occurred. If a `highlight` tweak is given with no value, its value is defined to be
|
||||||
/// `true`. If no highlight tweak is given at all then the value of `highlight` is defined to be
|
/// `true`. If no highlight tweak is given at all then the value of `highlight` is defined to
|
||||||
/// `false`.
|
/// be `false`.
|
||||||
Highlight(#[serde(default = "ruma_serde::default_true")] bool),
|
Highlight(#[serde(default = "ruma_serde::default_true")] bool),
|
||||||
|
|
||||||
/// A custom tweak
|
/// A custom tweak
|
||||||
|
@ -16,8 +16,8 @@ pub enum PushCondition {
|
|||||||
|
|
||||||
/// The glob-style pattern to match against.
|
/// The glob-style pattern to match against.
|
||||||
///
|
///
|
||||||
/// Patterns with no special glob characters should be treated as having asterisks prepended
|
/// Patterns with no special glob characters should be treated as having asterisks
|
||||||
/// and appended when testing the condition.
|
/// prepended and appended when testing the condition.
|
||||||
pattern: String,
|
pattern: String,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ impl Ruleset {
|
|||||||
|
|
||||||
/// Default override push rules
|
/// Default override push rules
|
||||||
impl ConditionalPushRule {
|
impl ConditionalPushRule {
|
||||||
/// Matches all events, this can be enabled to turn off all push
|
/// Matches all events, this can be enabled to turn off all push notifications other than those
|
||||||
/// notifications other than those generated by override rules set by the user.
|
/// generated by override rules set by the user.
|
||||||
pub fn master() -> Self {
|
pub fn master() -> Self {
|
||||||
Self {
|
Self {
|
||||||
actions: vec![DontNotify],
|
actions: vec![DontNotify],
|
||||||
@ -99,8 +99,8 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches any message whose content is unencrypted and contains the user's
|
/// Matches any message whose content is unencrypted and contains the user's current display
|
||||||
/// current display name in the room in which it was sent.
|
/// name in the room in which it was sent.
|
||||||
pub fn contains_display_name() -> Self {
|
pub fn contains_display_name() -> Self {
|
||||||
Self {
|
Self {
|
||||||
actions: vec![
|
actions: vec![
|
||||||
@ -131,8 +131,8 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches any message whose content is unencrypted and contains the
|
/// Matches any message whose content is unencrypted and contains the text `@room`, signifying
|
||||||
/// text `@room`, signifying the whole room should be notified of the event.
|
/// the whole room should be notified of the event.
|
||||||
pub fn roomnotif() -> Self {
|
pub fn roomnotif() -> Self {
|
||||||
Self {
|
Self {
|
||||||
actions: vec![Notify, SetTweak(Tweak::Highlight(true))],
|
actions: vec![Notify, SetTweak(Tweak::Highlight(true))],
|
||||||
@ -149,8 +149,8 @@ impl ConditionalPushRule {
|
|||||||
|
|
||||||
/// Default content push rules
|
/// Default content push rules
|
||||||
impl PatternedPushRule {
|
impl PatternedPushRule {
|
||||||
/// Matches any message whose content is unencrypted and contains
|
/// Matches any message whose content is unencrypted and contains the local part of the user's
|
||||||
/// the local part of the user's Matrix ID, separated by word boundaries.
|
/// Matrix ID, separated by word boundaries.
|
||||||
pub fn contains_user_name(user_id: &UserId) -> Self {
|
pub fn contains_user_name(user_id: &UserId) -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: ".m.rules.contains_user_name".into(),
|
rule_id: ".m.rules.contains_user_name".into(),
|
||||||
@ -183,12 +183,10 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches any encrypted event sent in a room with exactly
|
/// Matches any encrypted event sent in a room with exactly two members. Unlike other push
|
||||||
/// two members. Unlike other push rules, this rule cannot be
|
/// rules, this rule cannot be matched against the content of the event by nature of it being
|
||||||
/// matched against the content of the event by nature of it
|
/// encrypted. This causes the rule to be an "all or nothing" match where it either matches all
|
||||||
/// being encrypted. This causes the rule to be an "all or
|
/// events that are encrypted (in 1:1 rooms) or none.
|
||||||
/// nothing" match where it either matches all events that are
|
|
||||||
/// encrypted (in 1:1 rooms) or none.
|
|
||||||
pub fn encrypted_room_one_to_one() -> Self {
|
pub fn encrypted_room_one_to_one() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: ".m.rules.encrypted_room_one_to_one".into(),
|
rule_id: ".m.rules.encrypted_room_one_to_one".into(),
|
||||||
@ -235,11 +233,10 @@ impl ConditionalPushRule {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Matches all encrypted events. Unlike other push rules,
|
/// Matches all encrypted events. Unlike other push rules, this rule cannot be matched against
|
||||||
/// this rule cannot be matched against the content of the
|
/// the content of the event by nature of it being encrypted. This causes the rule to be an
|
||||||
/// event by nature of it being encrypted. This causes the
|
/// "all or nothing" match where it either matches all events that are encrypted (in group
|
||||||
/// rule to be an "all or nothing" match where it either matches
|
/// rooms) or none.
|
||||||
/// all events that are encrypted (in group rooms) or none.
|
|
||||||
pub fn encrypted() -> Self {
|
pub fn encrypted() -> Self {
|
||||||
Self {
|
Self {
|
||||||
rule_id: ".m.rules.encrypted".into(),
|
rule_id: ".m.rules.encrypted".into(),
|
||||||
|
@ -192,8 +192,8 @@ pub struct EventEnumInput {
|
|||||||
///
|
///
|
||||||
/// This will generate the variants of the event type "name". There needs to be a corresponding
|
/// This will generate the variants of the event type "name". There needs to be a corresponding
|
||||||
/// variant in `ruma_events::EventType` for this event (converted to a valid Rust-style type
|
/// variant in `ruma_events::EventType` for this event (converted to a valid Rust-style type
|
||||||
/// name by stripping `m.`, replacing the remaining dots by underscores and then converting from
|
/// name by stripping `m.`, replacing the remaining dots by underscores and then converting
|
||||||
/// snake_case to CamelCase).
|
/// from snake_case to CamelCase).
|
||||||
pub events: Vec<EventEnumEntry>,
|
pub events: Vec<EventEnumEntry>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ pub struct MacEventContent {
|
|||||||
/// The MAC is encoded as unpadded Base64.
|
/// The MAC is encoded as unpadded Base64.
|
||||||
pub mac: BTreeMap<String, String>,
|
pub mac: BTreeMap<String, String>,
|
||||||
|
|
||||||
/// The MAC of the comma-separated, sorted, list of key IDs given in the `mac` property, encoded
|
/// The MAC of the comma-separated, sorted, list of key IDs given in the `mac` property,
|
||||||
/// as unpadded Base64.
|
/// encoded as unpadded Base64.
|
||||||
pub keys: String,
|
pub keys: String,
|
||||||
}
|
}
|
||||||
|
@ -27,26 +27,25 @@
|
|||||||
//! Matrix defines three "kinds" of events:
|
//! Matrix defines three "kinds" of events:
|
||||||
//!
|
//!
|
||||||
//! 1. **Events**, which are arbitrary JSON structures that have two required keys:
|
//! 1. **Events**, which are arbitrary JSON structures that have two required keys:
|
||||||
//! * `type`, which specifies the event's type
|
//! * `type`, which specifies the event's type
|
||||||
//! * `content`, which is a JSON object containing the "payload" of the event
|
//! * `content`, which is a JSON object containing the "payload" of the event
|
||||||
//! 2. **Room events**, which are a superset of events and represent actions that occurred within
|
//! 2. **Room events**, which are a superset of events and represent actions that occurred within
|
||||||
//! the context of a Matrix room.
|
//! the context of a Matrix room.
|
||||||
//! They have at least the following additional keys:
|
//! They have at least the following additional keys:
|
||||||
//! * `event_id`, which is a unique identifier for the event
|
//! * `event_id`, which is a unique identifier for the event
|
||||||
//! * `room_id`, which is a unique identifier for the room in which the event occurred
|
//! * `room_id`, which is a unique identifier for the room in which the event occurred
|
||||||
//! * `sender`, which is the unique identifier of the Matrix user who created the event
|
//! * `sender`, which is the unique identifier of the Matrix user who created the event
|
||||||
//! * Optionally, `unsigned`, which is a JSON object containing arbitrary additional metadata
|
//! * Optionally, `unsigned`, which is a JSON object containing arbitrary additional metadata
|
||||||
//! that is not digitally signed by Matrix homeservers.
|
//! that is not digitally signed by Matrix homeservers.
|
||||||
//! 3. **State events**, which are a superset of room events and represent persistent state
|
//! 3. **State events**, which are a superset of room events and represent persistent state
|
||||||
//! specific to a room, such as the room's member list or topic.
|
//! specific to a room, such as the room's member list or topic.
|
||||||
//! Within a single room, state events of the same type and with the same "state key" will
|
//! Within a single room, state events of the same type and with the same "state key" will
|
||||||
//! effectively "replace" the previous one, updating the room's state.
|
//! effectively "replace" the previous one, updating the room's state.
|
||||||
//! They have at least the following additional keys:
|
//! They have at least the following additional keys:
|
||||||
//! * `state_key`, a string which serves as a sort of "sub-type."
|
//! * `state_key`, a string which serves as a sort of "sub-type." The state key allows a room to
|
||||||
//! The state key allows a room to persist multiple state events of the same type.
|
//! persist multiple state events of the same type. You can think of a room's state events as
|
||||||
//! You can think of a room's state events as being a `BTreeMap` where the keys are the
|
//! being a `BTreeMap` where the keys are the tuple `(event_type, state_key)`.
|
||||||
//! tuple `(event_type, state_key)`.
|
//! * Optionally, `prev_content`, a JSON object containing the `content` object from the
|
||||||
//! * Optionally, `prev_content`, a JSON object containing the `content` object from the
|
|
||||||
//! previous event of the given `(event_type, state_key)` tuple in the given room.
|
//! previous event of the given `(event_type, state_key)` tuple in the given room.
|
||||||
//!
|
//!
|
||||||
//! ruma-events represents these three event kinds as traits, allowing any Rust type to serve as a
|
//! ruma-events represents these three event kinds as traits, allowing any Rust type to serve as a
|
||||||
|
@ -11,7 +11,8 @@ pub mod user;
|
|||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub struct PolicyRuleEventContent {
|
pub struct PolicyRuleEventContent {
|
||||||
/// The entity affected by this rule. Glob characters * and ? can be used to match zero or more and one or more characters respectively.
|
/// The entity affected by this rule. Glob characters * and ? can be used to match zero or more
|
||||||
|
/// and one or more characters respectively.
|
||||||
pub entity: String,
|
pub entity: String,
|
||||||
|
|
||||||
/// The suggested action to take.
|
/// The suggested action to take.
|
||||||
|
@ -246,8 +246,9 @@ pub struct FileInfo {
|
|||||||
/// The payload for an image message.
|
/// The payload for an image message.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct ImageMessageEventContent {
|
pub struct ImageMessageEventContent {
|
||||||
/// A textual representation of the image. This could be the alt text of the image, the filename
|
/// A textual representation of the image. This could be the alt text of the image, the
|
||||||
/// of the image, or some kind of content description for accessibility e.g. "image attachment."
|
/// filename of the image, or some kind of content description for accessibility e.g.
|
||||||
|
/// "image attachment."
|
||||||
pub body: String,
|
pub body: String,
|
||||||
|
|
||||||
/// Metadata about the image referred to in `url`.
|
/// Metadata about the image referred to in `url`.
|
||||||
@ -267,8 +268,8 @@ pub struct ImageMessageEventContent {
|
|||||||
/// The payload for a location message.
|
/// The payload for a location message.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct LocationMessageEventContent {
|
pub struct LocationMessageEventContent {
|
||||||
/// A description of the location e.g. "Big Ben, London, UK,"or some kind of content description
|
/// A description of the location e.g. "Big Ben, London, UK,"or some kind of content
|
||||||
/// for accessibility, e.g. "location attachment."
|
/// description for accessibility, e.g. "location attachment."
|
||||||
pub body: String,
|
pub body: String,
|
||||||
|
|
||||||
/// A geo URI representing the location.
|
/// A geo URI representing the location.
|
||||||
@ -291,8 +292,8 @@ pub struct LocationInfo {
|
|||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_url: Option<String>,
|
pub thumbnail_url: Option<String>,
|
||||||
|
|
||||||
/// Information on an encrypted thumbnail of the location being represented. Only present if the
|
/// Information on an encrypted thumbnail of the location being represented. Only present if
|
||||||
/// thumbnail is encrypted.
|
/// the thumbnail is encrypted.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub thumbnail_file: Option<Box<EncryptedFile>>,
|
pub thumbnail_file: Option<Box<EncryptedFile>>,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
//! Endpoint to submits a signed leave event to the receiving server for it to accept it into the room's graph.
|
//! Endpoint to submits a signed leave event to the receiving server for it to accept it into the
|
||||||
|
//! room's graph.
|
||||||
|
|
||||||
pub mod v1;
|
pub mod v1;
|
||||||
pub mod v2;
|
pub mod v2;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
//! Endpoint to asks the receiving server to return information that the sending server will need to prepare a leave event to get out of the room.
|
//! Endpoint to asks the receiving server to return information that the sending server will need
|
||||||
|
//! to prepare a leave event to get out of the room.
|
||||||
|
|
||||||
pub mod v1;
|
pub mod v1;
|
||||||
|
@ -273,7 +273,8 @@ mod tweak_serde {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no highlight tweak is given at all then the value of highlight is defined to be false.
|
// If no highlight tweak is given at all then the value of highlight is defined to be
|
||||||
|
// false.
|
||||||
if !tweaks.iter().any(|tw| matches!(tw, Tweak::Highlight(_))) {
|
if !tweaks.iter().any(|tw| matches!(tw, Tweak::Highlight(_))) {
|
||||||
tweaks.push(Tweak::Highlight(false));
|
tweaks.push(Tweak::Highlight(false));
|
||||||
}
|
}
|
||||||
|
@ -79,13 +79,13 @@ where
|
|||||||
|
|
||||||
/// A deserializer for the `application/x-www-form-urlencoded` format.
|
/// A deserializer for the `application/x-www-form-urlencoded` format.
|
||||||
///
|
///
|
||||||
/// * Supported top-level outputs are structs, maps and sequences of pairs,
|
/// * Supported top-level outputs are structs, maps and sequences of pairs, with or without a given
|
||||||
/// with or without a given length.
|
/// length.
|
||||||
///
|
///
|
||||||
/// * Main `deserialize` methods defers to `deserialize_map`.
|
/// * Main `deserialize` methods defers to `deserialize_map`.
|
||||||
///
|
///
|
||||||
/// * Everything else but `deserialize_seq` and `deserialize_seq_fixed_size`
|
/// * Everything else but `deserialize_seq` and `deserialize_seq_fixed_size` defers to
|
||||||
/// defers to `deserialize`.
|
/// `deserialize`.
|
||||||
pub struct Deserializer<'de> {
|
pub struct Deserializer<'de> {
|
||||||
inner: MapDeserializer<'de, EntryIterator<'de>, Error>,
|
inner: MapDeserializer<'de, EntryIterator<'de>, Error>,
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,11 @@ pub fn to_string<T: ser::Serialize>(input: T) -> Result<String, Error> {
|
|||||||
|
|
||||||
/// A serializer for the `application/x-www-form-urlencoded` format.
|
/// A serializer for the `application/x-www-form-urlencoded` format.
|
||||||
///
|
///
|
||||||
/// * Supported top-level inputs are structs, maps and sequences of pairs,
|
/// * Supported top-level inputs are structs, maps and sequences of pairs, with or without a given
|
||||||
/// with or without a given length.
|
/// length.
|
||||||
///
|
///
|
||||||
/// * Supported keys and values are integers, bytes (if convertible to strings),
|
/// * Supported keys and values are integers, bytes (if convertible to strings), unit structs and
|
||||||
/// unit structs and unit variants.
|
/// unit variants.
|
||||||
///
|
///
|
||||||
/// * Newtype structs defer to their inner values.
|
/// * Newtype structs defer to their inner values.
|
||||||
pub struct Serializer<'input, 'output, Target: 'output + UrlEncodedTarget> {
|
pub struct Serializer<'input, 'output, Target: 'output + UrlEncodedTarget> {
|
||||||
|
@ -34,9 +34,9 @@ impl Ed25519KeyPair {
|
|||||||
/// # Parameters
|
/// # Parameters
|
||||||
///
|
///
|
||||||
/// * document: PKCS8-formatted bytes containing the private & public keys.
|
/// * document: PKCS8-formatted bytes containing the private & public keys.
|
||||||
/// * version: The "version" of the key used for this signature.
|
/// * version: The "version" of the key used for this signature. Versions are used as an
|
||||||
/// Versions are used as an identifier to distinguish signatures generated from different keys
|
/// identifier to distinguish signatures generated from different keys but using the same
|
||||||
/// but using the same algorithm on the same homeserver.
|
/// algorithm on the same homeserver.
|
||||||
///
|
///
|
||||||
/// # Errors
|
/// # Errors
|
||||||
///
|
///
|
||||||
|
Loading…
x
Reference in New Issue
Block a user