events: Small documentation improvements

This commit is contained in:
Jonas Platte 2021-10-01 18:46:21 +02:00
parent 802c83f38b
commit 678d3cd4ee
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
5 changed files with 19 additions and 13 deletions

View File

@ -36,8 +36,7 @@ ruma_api! {
/// List of state events to send to the new room. /// List of state events to send to the new room.
/// ///
/// Takes precedence over events set by preset, but gets overridden by /// Takes precedence over events set by preset, but gets overridden by name and topic keys.
/// name and topic keys.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub initial_state: &'a [Raw<AnyInitialStateEvent>], pub initial_state: &'a [Raw<AnyInitialStateEvent>],
@ -55,8 +54,8 @@ ruma_api! {
#[serde(default, skip_serializing_if = "ruma_serde::is_default")] #[serde(default, skip_serializing_if = "ruma_serde::is_default")]
pub is_direct: bool, pub is_direct: bool,
/// If this is included, an `m.room.name` event will be sent into the room to indicate /// If this is included, an `m.room.name` event will be sent into the room to indicate the
/// the name of the room. /// name of the room.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<&'a RoomName>, pub name: Option<&'a RoomName>,

View File

@ -169,15 +169,17 @@ impl AnyRoomEvent {
room_ev_accessor!(sender: &UserId); room_ev_accessor!(sender: &UserId);
} }
/// Any sync room event (room event without a `room_id`, as returned in `/sync` responses) /// Any sync room event.
///
/// Sync room events are room event without a `room_id`, as returned in `/sync` responses.
#[allow(clippy::large_enum_variant, clippy::exhaustive_enums)] #[allow(clippy::large_enum_variant, clippy::exhaustive_enums)]
#[derive(Clone, Debug, Serialize, EventEnumFromEvent)] #[derive(Clone, Debug, Serialize, EventEnumFromEvent)]
#[serde(untagged)] #[serde(untagged)]
pub enum AnySyncRoomEvent { pub enum AnySyncRoomEvent {
/// Any sync message event /// Any sync message event.
Message(AnySyncMessageEvent), Message(AnySyncMessageEvent),
/// Any sync state event /// Any sync state event.
State(AnySyncStateEvent), State(AnySyncStateEvent),
/// Any sync message event that has been redacted. /// Any sync message event that has been redacted.

View File

@ -31,8 +31,8 @@ pub struct ToDeviceMacEventContent {
} }
impl ToDeviceMacEventContent { impl ToDeviceMacEventContent {
/// Creates a new `ToDeviceMacEventContent` with the given transaction ID, key ID to MAC /// Creates a new `ToDeviceMacEventContent` with the given transaction ID, key ID to MAC map and
/// map and key MAC. /// key MAC.
pub fn new(transaction_id: String, mac: BTreeMap<String, String>, keys: String) -> Self { pub fn new(transaction_id: String, mac: BTreeMap<String, String>, keys: String) -> Self {
Self { transaction_id, mac, keys } Self { transaction_id, mac, keys }
} }

View File

@ -120,8 +120,7 @@ pub struct ReciprocateV1Content {
impl ReciprocateV1Content { impl ReciprocateV1Content {
/// Create a new `ReciprocateV1Content` with the given shared secret. /// Create a new `ReciprocateV1Content` with the given shared secret.
/// ///
/// The shared secret needs to come from the scanned QR code, encoded using /// The shared secret needs to come from the scanned QR code, encoded using unpadded base64.
/// unpadded base64.
pub fn new(secret: String) -> Self { pub fn new(secret: String) -> Self {
Self { secret } Self { secret }
} }

View File

@ -123,6 +123,7 @@ pub struct EncryptedFile {
pub iv: String, pub iv: String,
/// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64. /// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64.
///
/// Clients should support the SHA-256 hash, which uses the key sha256. /// Clients should support the SHA-256 hash, which uses the key sha256.
pub hashes: BTreeMap<String, String>, pub hashes: BTreeMap<String, String>,
@ -147,6 +148,7 @@ pub struct EncryptedFileInit {
pub iv: String, pub iv: String,
/// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64. /// A map from an algorithm name to a hash of the ciphertext, encoded as unpadded base64.
///
/// Clients should support the SHA-256 hash, which uses the key sha256. /// Clients should support the SHA-256 hash, which uses the key sha256.
pub hashes: BTreeMap<String, String>, pub hashes: BTreeMap<String, String>,
@ -180,7 +182,9 @@ pub struct JsonWebKey {
/// The key, encoded as url-safe unpadded base64. /// The key, encoded as url-safe unpadded base64.
pub k: String, pub k: String,
/// Extractable. Must be `true`. This is a /// Extractable.
///
/// Must be `true`. This is a
/// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk). /// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk).
pub ext: bool, pub ext: bool,
} }
@ -204,7 +208,9 @@ pub struct JsonWebKeyInit {
/// The key, encoded as url-safe unpadded base64. /// The key, encoded as url-safe unpadded base64.
pub k: String, pub k: String,
/// Extractable. Must be `true`. This is a /// Extractable.
///
/// Must be `true`. This is a
/// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk). /// [W3C extension](https://w3c.github.io/webcrypto/#iana-section-jwk).
pub ext: bool, pub ext: bool,
} }