Skip to content

Commit c7979cb

Browse files
committed
doc(base): Add missing documentation.
1 parent bf40bf8 commit c7979cb

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

crates/matrix-sdk-base/src/sliding_sync/http.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,21 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
//! HTTP types for (Simplified) MSC3575.
16+
//!
17+
//! This module provides a unified namings for types from MSC3575 and
18+
//! Simplified MSC3575, in addition to provide conversion from one
19+
//! format to another.
20+
1521
use std::collections::BTreeMap;
1622

23+
/// Same trait as [`std::convert::From`].
24+
///
25+
/// Because we are converting types that all live in another
26+
// crate (`ruma`), we cannot implement `From` on them, so we
27+
// need a custom local trait, hence this `From` trait.
1728
pub trait From<T>: Sized {
29+
/// See [`std::convert::From::from`].
1830
fn from(value: T) -> Self;
1931
}
2032

@@ -46,7 +58,13 @@ where
4658
}
4759
}
4860

61+
/// Same trait as [`std::convert::Into`].
62+
///
63+
/// Because we are converting types that all live in another
64+
// crate (`ruma`), we cannot implement `Into` on them, so we
65+
// need a custom local trait, hence this `Into` trait.
4966
pub trait Into<T>: Sized {
67+
/// See [`std::convert::Into::into`].
5068
#[must_use]
5169
fn into(self) -> T;
5270
}
@@ -62,6 +80,7 @@ where
6280
}
6381
}
6482

83+
/// HTTP types from MSC3575, renamed to match the Simplified MSC3575 namings.
6584
pub mod msc3575 {
6685
use super::{simplified_msc3575 as sss, From};
6786
use ruma::{api::client::sync::sync_events::v4, events::TimelineEventType};
@@ -79,6 +98,8 @@ pub mod msc3575 {
7998
SlidingSyncRoomHero as ResponseRoomHero, SyncList as ResponseList,
8099
};
81100

101+
/// HTTP types for MSC3575 extensions, renamed to match the Simplified
102+
/// MSC3575 namings.
82103
pub mod extensions {
83104
// Request types.
84105
pub use super::v4::{
@@ -118,6 +139,8 @@ pub mod msc3575 {
118139
s.room_details = From::from(value.room_details);
119140
s.include_heroes = value.include_heroes;
120141
s.filters = From::from(value.filters);
142+
143+
// Defaults from Simplified MSC3575.
121144
s.sort = vec!["by_recency".to_string(), "by_name".to_string()];
122145
s.bump_event_types = vec![
123146
TimelineEventType::RoomMessage,
@@ -247,6 +270,7 @@ pub mod msc3575 {
247270
}
248271
}
249272

273+
/// HTTP types from Simplified MSC3575.
250274
pub mod simplified_msc3575 {
251275
use super::{msc3575 as ss, From};
252276
pub use ruma::api::client::sync::sync_events::v5::*;

crates/matrix-sdk-base/src/sliding_sync/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
//! Extend `BaseClient` with capabilities to handle MSC3575.
16+
1517
pub mod http;
1618

1719
use std::collections::BTreeMap;

0 commit comments

Comments
 (0)