diff --git a/crates/ruma-client-api/src/filter.rs b/crates/ruma-client-api/src/filter.rs index 5a48b6c0..0d6cc083 100644 --- a/crates/ruma-client-api/src/filter.rs +++ b/crates/ruma-client-api/src/filter.rs @@ -47,10 +47,7 @@ impl Default for EventFormat { } /// Relation types as defined in `rel_type` of an `m.relates_to` field. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[cfg(feature = "unstable-msc3440")] #[non_exhaustive] diff --git a/crates/ruma-client-api/src/push.rs b/crates/ruma-client-api/src/push.rs index 27f5b476..4586fa14 100644 --- a/crates/ruma-client-api/src/push.rs +++ b/crates/ruma-client-api/src/push.rs @@ -197,10 +197,7 @@ impl RuleKind { } /// Which kind a pusher is. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "snake_case")] #[non_exhaustive] diff --git a/crates/ruma-client-api/src/search/search_events.rs b/crates/ruma-client-api/src/search/search_events.rs index 6cc9e655..fc634087 100644 --- a/crates/ruma-client-api/src/search/search_events.rs +++ b/crates/ruma-client-api/src/search/search_events.rs @@ -295,10 +295,7 @@ pub mod v3 { } /// The keys to search for. - /// - /// This type can hold an arbitrary string. To build this with a custom value, convert it from a - /// string with `::from() / .into()`. To check for formats that are not available as a - /// documented variant here, use its string representation, obtained through `.as_str()`. + #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[non_exhaustive] pub enum SearchKeys { @@ -326,10 +323,7 @@ pub mod v3 { } /// The order in which to search for results. - /// - /// This type can hold an arbitrary string. To build this with a custom value, convert it from a - /// string with `::from() / .into()`. To check for formats that are not available as a - /// documented variant here, use its string representation, obtained through `.as_str()`. + #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[ruma_enum(rename_all = "snake_case")] diff --git a/crates/ruma-common/src/events/key/verification.rs b/crates/ruma-common/src/events/key/verification.rs index 06810f6f..8a41000f 100644 --- a/crates/ruma-common/src/events/key/verification.rs +++ b/crates/ruma-common/src/events/key/verification.rs @@ -41,10 +41,7 @@ impl HashAlgorithm { } /// A key agreement protocol. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "kebab-case")] #[non_exhaustive] @@ -67,10 +64,7 @@ impl KeyAgreementProtocol { } /// A message authentication code algorithm. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "kebab-case")] #[non_exhaustive] @@ -93,10 +87,7 @@ impl MessageAuthenticationCode { } /// A Short Authentication String method. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "snake_case")] #[non_exhaustive] @@ -135,10 +126,7 @@ impl Relation { } /// A Short Authentication String (SAS) verification method. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[non_exhaustive] pub enum VerificationMethod { diff --git a/crates/ruma-common/src/events/room/message.rs b/crates/ruma-common/src/events/room/message.rs index 18f78824..8f4bc6fe 100644 --- a/crates/ruma-common/src/events/room/message.rs +++ b/crates/ruma-common/src/events/room/message.rs @@ -1492,10 +1492,7 @@ impl ServerNoticeType { } /// Types of usage limits. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "snake_case")] #[non_exhaustive] @@ -1518,10 +1515,7 @@ impl LimitType { } /// The format for the formatted representation of a message body. -/// -/// This type can hold an arbitrary string. To build this with a custom value, convert it from a -/// string with `::from() / .into()`. To check for formats that are not available as a documented -/// variant here, use its string representation, obtained through `.as_str()`. +#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[non_exhaustive] pub enum MessageFormat {