events: Remove deprecated API
This commit is contained in:
parent
a11c27e7e1
commit
028eb8a457
@ -1,5 +1,10 @@
|
|||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
* Remove deprecated `EventType` enum
|
||||||
|
* Remove deprecated constructors for `RoomMessageEventContent`
|
||||||
|
|
||||||
# 0.10.3
|
# 0.10.3
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! [`m.room.message`]: https://spec.matrix.org/v1.2/client-server-api/#mroommessage
|
//! [`m.room.message`]: https://spec.matrix.org/v1.2/client-server-api/#mroommessage
|
||||||
|
|
||||||
use std::{borrow::Cow, fmt};
|
use std::borrow::Cow;
|
||||||
|
|
||||||
use ruma_macros::EventContent;
|
use ruma_macros::EventContent;
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
@ -161,60 +161,6 @@ impl RoomMessageEventContent {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a plain text reply to a message.
|
|
||||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/rich_reply.md"))]
|
|
||||||
#[deprecated = "\
|
|
||||||
use [`Self::text_plain`](#method.text_plain)`(reply).`\
|
|
||||||
[`make_reply_to`](#method.make_reply_to)`(original_message)` instead\
|
|
||||||
"]
|
|
||||||
pub fn text_reply_plain(
|
|
||||||
reply: impl fmt::Display,
|
|
||||||
original_message: &OriginalRoomMessageEvent,
|
|
||||||
) -> Self {
|
|
||||||
Self::text_plain(reply.to_string()).make_reply_to(original_message)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a html text reply to a message.
|
|
||||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/rich_reply.md"))]
|
|
||||||
#[deprecated = "\
|
|
||||||
use [`Self::text_html`](#method.text_html)`(reply, html_reply).`\
|
|
||||||
[`make_reply_to`](#method.make_reply_to)`(original_message)` instead\
|
|
||||||
"]
|
|
||||||
pub fn text_reply_html(
|
|
||||||
reply: impl fmt::Display,
|
|
||||||
html_reply: impl fmt::Display,
|
|
||||||
original_message: &OriginalRoomMessageEvent,
|
|
||||||
) -> Self {
|
|
||||||
Self::text_html(reply.to_string(), html_reply.to_string()).make_reply_to(original_message)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a plain text notice reply to a message.
|
|
||||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/rich_reply.md"))]
|
|
||||||
#[deprecated = "\
|
|
||||||
use [`Self::notice_plain`](#method.notice_plain)`(reply).`\
|
|
||||||
[`make_reply_to`](#method.make_reply_to)`(original_message)` instead\
|
|
||||||
"]
|
|
||||||
pub fn notice_reply_plain(
|
|
||||||
reply: impl fmt::Display,
|
|
||||||
original_message: &OriginalRoomMessageEvent,
|
|
||||||
) -> Self {
|
|
||||||
Self::notice_plain(reply.to_string()).make_reply_to(original_message)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Creates a html text notice reply to a message.
|
|
||||||
#[doc = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/doc/rich_reply.md"))]
|
|
||||||
#[deprecated = "\
|
|
||||||
use [`Self::notice_html`](#method.notice_html)`(reply, html_reply).`\
|
|
||||||
[`make_reply_to`](#method.make_reply_to)`(original_message)` instead\
|
|
||||||
"]
|
|
||||||
pub fn notice_reply_html(
|
|
||||||
reply: impl fmt::Display,
|
|
||||||
html_reply: impl fmt::Display,
|
|
||||||
original_message: &OriginalRoomMessageEvent,
|
|
||||||
) -> Self {
|
|
||||||
Self::notice_html(reply.to_string(), html_reply.to_string()).make_reply_to(original_message)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Create a new reply with the given message and optionally forwards the [`Relation::Thread`].
|
/// Create a new reply with the given message and optionally forwards the [`Relation::Thread`].
|
||||||
///
|
///
|
||||||
/// If `message` is a text, an emote or a notice message, it is modified to include the rich
|
/// If `message` is a text, an emote or a notice message, it is modified to include the rich
|
||||||
|
@ -46,10 +46,6 @@ pub fn expand_event_type_enum(
|
|||||||
|
|
||||||
let mut res = TokenStream::new();
|
let mut res = TokenStream::new();
|
||||||
|
|
||||||
res.extend(
|
|
||||||
generate_enum("EventType", &all, &ruma_common)
|
|
||||||
.unwrap_or_else(syn::Error::into_compile_error),
|
|
||||||
);
|
|
||||||
res.extend(
|
res.extend(
|
||||||
generate_enum("RoomEventType", &room, &ruma_common)
|
generate_enum("RoomEventType", &room, &ruma_common)
|
||||||
.unwrap_or_else(syn::Error::into_compile_error),
|
.unwrap_or_else(syn::Error::into_compile_error),
|
||||||
@ -90,12 +86,6 @@ fn generate_enum(
|
|||||||
let serde = quote! { #ruma_common::exports::serde };
|
let serde = quote! { #ruma_common::exports::serde };
|
||||||
let enum_doc = format!("The type of `{}` this is.", ident.strip_suffix("Type").unwrap());
|
let enum_doc = format!("The type of `{}` this is.", ident.strip_suffix("Type").unwrap());
|
||||||
|
|
||||||
let deprecated_attr = (ident == "EventType").then(|| {
|
|
||||||
quote! {
|
|
||||||
#[deprecated = "use a fine-grained event type enum like RoomEventType instead"]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let ident = Ident::new(ident, Span::call_site());
|
let ident = Ident::new(ident, Span::call_site());
|
||||||
|
|
||||||
let mut deduped: Vec<&EventEnumEntry> = vec![];
|
let mut deduped: Vec<&EventEnumEntry> = vec![];
|
||||||
@ -204,7 +194,6 @@ fn generate_enum(
|
|||||||
/// This type can hold an arbitrary string. To build events with a custom type, convert it
|
/// This type can hold an arbitrary string. To build events with a custom type, convert it
|
||||||
/// from a string with `::from() / .into()`. To check for events that are not available as a
|
/// from a string with `::from() / .into()`. To check for events that are not available as a
|
||||||
/// documented variant here, use its string representation, obtained through `.to_string()`.
|
/// documented variant here, use its string representation, obtained through `.to_string()`.
|
||||||
#deprecated_attr
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||||
pub enum #ident {
|
pub enum #ident {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user