matrix-sdk: Fix the docs for our feature flags.

master
Damir Jelić 2020-08-13 12:18:24 +02:00
parent d4de877e09
commit d4e31f07a1
3 changed files with 22 additions and 8 deletions

View File

@ -10,12 +10,19 @@ readme = "README.md"
repository = "https://github.com/matrix-org/matrix-rust-sdk"
version = "0.1.0"
[package.metadata.docs.rs]
features = ["docs"]
rustdoc-args = ["--cfg", "feature=\"docs\""]
[features]
default = ["encryption", "sqlite_cryptostore", "messages"]
messages = ["matrix-sdk-base/messages"]
encryption = ["matrix-sdk-base/encryption", "dashmap"]
sqlite_cryptostore = ["matrix-sdk-base/sqlite_cryptostore"]
docs = ["encryption", "sqlite_cryptostore", "messages"]
[dependencies]
async-trait = "0.1.36"
dashmap = { version = "3.11.10", optional = true }

View File

@ -953,6 +953,7 @@ impl Client {
///
/// Does nothing if no group session needs to be shared.
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
async fn preshare_group_session(&self, room_id: &RoomId) -> Result<()> {
// TODO expose this publicly so people can pre-share a group session if
// e.g. a user starts to type a message for a room.
@ -1318,7 +1319,7 @@ impl Client {
/// Panics if the client isn't logged in, or if no encryption keys need to
/// be uploaded.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
#[instrument]
async fn claim_one_time_keys(
&self,
@ -1347,7 +1348,7 @@ impl Client {
///
/// Panics if the client isn't logged in.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
#[instrument]
async fn share_group_session(&self, room_id: &RoomId) -> Result<()> {
let mut requests = self
@ -1373,7 +1374,7 @@ impl Client {
/// Panics if the client isn't logged in, or if no encryption keys need to
/// be uploaded.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
#[instrument]
async fn keys_upload(&self) -> Result<upload_keys::Response> {
let request = self
@ -1407,7 +1408,7 @@ impl Client {
///
/// Panics if no key query needs to be done.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
#[instrument]
async fn keys_query(&self) -> Result<get_keys::Response> {
let mut users_for_query = self
@ -1443,7 +1444,7 @@ impl Client {
/// Get a `Sas` verification object with the given flow id.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub async fn get_verification(&self, flow_id: &str) -> Option<Sas> {
self.base_client
.get_verification(flow_id)
@ -1465,7 +1466,7 @@ impl Client {
///
/// Returns a `Sas` object that represents the interactive verification flow.
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub async fn start_verification(&self, device: Device) -> Result<Sas> {
let (sas, request) = self
.base_client
@ -1513,7 +1514,7 @@ impl Client {
/// # });
/// ```
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub async fn get_device(&self, user_id: &UserId, device_id: &DeviceId) -> Option<Device> {
self.base_client.get_device(user_id, device_id).await
}
@ -1546,7 +1547,7 @@ impl Client {
/// # });
/// ```
#[cfg(feature = "encryption")]
#[cfg_attr(docsrs, doc(cfg(feature = "encryption")))]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub async fn get_user_devices(
&self,
user_id: &UserId,

View File

@ -35,6 +35,7 @@
unused_import_braces,
unused_qualifications
)]
#![cfg_attr(feature = "docs", feature(doc_cfg))]
#[cfg(not(target_arch = "wasm32"))]
pub use matrix_sdk_base::JsonStore;
@ -42,9 +43,13 @@ pub use matrix_sdk_base::{
CustomEvent, Error as BaseError, EventEmitter, Room, RoomState, Session, StateStore, SyncRoom,
};
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub use matrix_sdk_base::{Device, TrustState};
#[cfg(feature = "messages")]
#[cfg_attr(feature = "docs", doc(cfg(messages)))]
pub use matrix_sdk_base::{MessageQueue, PossiblyRedactedExt};
pub use matrix_sdk_common::*;
pub use reqwest::header::InvalidHeaderValue;
@ -63,6 +68,7 @@ pub use request_builder::{
MessagesRequestBuilder, RegistrationBuilder, RoomBuilder, RoomListFilterBuilder,
};
#[cfg(feature = "encryption")]
#[cfg_attr(feature = "docs", doc(cfg(encryption)))]
pub use sas::Sas;
#[cfg(not(target_arch = "wasm32"))]