doc: Use markdown doc for types deriving StringEnum

This commit is contained in:
Kévin Commaille 2022-05-30 15:12:58 +02:00 committed by Kévin Commaille
parent 49663f4adf
commit 4d89c7cc08
5 changed files with 10 additions and 40 deletions

View File

@ -47,10 +47,7 @@ impl Default for EventFormat {
} }
/// Relation types as defined in `rel_type` of an `m.relates_to` field. /// Relation types as defined in `rel_type` of an `m.relates_to` field.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[cfg(feature = "unstable-msc3440")] #[cfg(feature = "unstable-msc3440")]
#[non_exhaustive] #[non_exhaustive]

View File

@ -197,10 +197,7 @@ impl RuleKind {
} }
/// Which kind a pusher is. /// Which kind a pusher is.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "snake_case")] #[ruma_enum(rename_all = "snake_case")]
#[non_exhaustive] #[non_exhaustive]

View File

@ -295,10 +295,7 @@ pub mod v3 {
} }
/// The keys to search for. /// The keys to search for.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[non_exhaustive] #[non_exhaustive]
pub enum SearchKeys { pub enum SearchKeys {
@ -326,10 +323,7 @@ pub mod v3 {
} }
/// The order in which to search for results. /// The order in which to search for results.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
#[ruma_enum(rename_all = "snake_case")] #[ruma_enum(rename_all = "snake_case")]

View File

@ -41,10 +41,7 @@ impl HashAlgorithm {
} }
/// A key agreement protocol. /// A key agreement protocol.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "kebab-case")] #[ruma_enum(rename_all = "kebab-case")]
#[non_exhaustive] #[non_exhaustive]
@ -67,10 +64,7 @@ impl KeyAgreementProtocol {
} }
/// A message authentication code algorithm. /// A message authentication code algorithm.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "kebab-case")] #[ruma_enum(rename_all = "kebab-case")]
#[non_exhaustive] #[non_exhaustive]
@ -93,10 +87,7 @@ impl MessageAuthenticationCode {
} }
/// A Short Authentication String method. /// A Short Authentication String method.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "snake_case")] #[ruma_enum(rename_all = "snake_case")]
#[non_exhaustive] #[non_exhaustive]
@ -135,10 +126,7 @@ impl Relation {
} }
/// A Short Authentication String (SAS) verification method. /// A Short Authentication String (SAS) verification method.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[non_exhaustive] #[non_exhaustive]
pub enum VerificationMethod { pub enum VerificationMethod {

View File

@ -1492,10 +1492,7 @@ impl ServerNoticeType {
} }
/// Types of usage limits. /// Types of usage limits.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[ruma_enum(rename_all = "snake_case")] #[ruma_enum(rename_all = "snake_case")]
#[non_exhaustive] #[non_exhaustive]
@ -1518,10 +1515,7 @@ impl LimitType {
} }
/// The format for the formatted representation of a message body. /// The format for the formatted representation of a message body.
/// #[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/string_enum.md"))]
/// 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()`.
#[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[derive(Clone, Debug, PartialEq, Eq, StringEnum)]
#[non_exhaustive] #[non_exhaustive]
pub enum MessageFormat { pub enum MessageFormat {