Derive Default for lots of types
This commit is contained in:
parent
647f56e0a1
commit
d7c977e593
@ -14,6 +14,7 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The transaction ID for this set of events.
|
||||
///
|
||||
@ -26,6 +27,8 @@ ruma_api! {
|
||||
pub events: &'a [Raw<AnyEvent>],
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
//! endpoint in the [Matrix](https://matrix.org/) application service API specification. These
|
||||
//! types can be shared by application service and server code.
|
||||
#![warn(missing_copy_implementations, missing_debug_implementations, missing_docs)]
|
||||
#![allow(clippy::new_without_default)]
|
||||
|
||||
pub mod event;
|
||||
pub mod query;
|
||||
|
@ -13,12 +13,15 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The room alias being queried.
|
||||
#[ruma_api(path)]
|
||||
pub room_alias: &'a RoomAliasId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
}
|
||||
|
||||
|
@ -13,12 +13,15 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The user ID being queried.
|
||||
#[ruma_api(path)]
|
||||
pub user_id: &'a UserId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
//! shared by client and server code.
|
||||
|
||||
#![warn(missing_copy_implementations, missing_debug_implementations, missing_docs)]
|
||||
#![allow(clippy::new_without_default)]
|
||||
|
||||
pub mod error;
|
||||
pub mod r0;
|
||||
|
@ -23,6 +23,7 @@ ruma_api! {
|
||||
pub room_id: &'a RoomId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -20,6 +20,7 @@ ruma_api! {
|
||||
pub room_alias: &'a RoomAliasId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -45,6 +45,7 @@ ruma_api! {
|
||||
pub filter: Option<RoomEventFilter<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// A token that can be used to paginate backwards with.
|
||||
@ -87,14 +88,7 @@ impl<'a> Request<'a> {
|
||||
impl Response {
|
||||
/// Creates an empty `Response`.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
start: None,
|
||||
end: None,
|
||||
events_before: Vec::new(),
|
||||
event: None,
|
||||
events_after: Vec::new(),
|
||||
state: Vec::new(),
|
||||
}
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ ruma_api! {
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -20,6 +20,7 @@ ruma_api! {
|
||||
pub room_id: &'a RoomId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -27,6 +27,7 @@ ruma_api! {
|
||||
pub reason: Option<&'a str>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -20,6 +20,7 @@ ruma_api! {
|
||||
pub room_id: &'a RoomId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -23,6 +23,7 @@ ruma_api! {
|
||||
pub user_id: &'a UserId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -63,6 +63,7 @@ ruma_api! {
|
||||
pub filter: Option<RoomEventFilter<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// The token the pagination starts from.
|
||||
@ -97,7 +98,7 @@ impl<'a> Request<'a> {
|
||||
impl Response {
|
||||
/// Creates an empty `Response`.
|
||||
pub fn new() -> Self {
|
||||
Self { start: None, end: None, chunk: Vec::new(), state: Vec::new() }
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// Extra keys to be added to the content of the `m.room.create`.
|
||||
@ -98,20 +99,7 @@ ruma_api! {
|
||||
impl Request {
|
||||
/// Creates a `Request` will all-default parameters.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
creation_content: None,
|
||||
initial_state: Vec::new(),
|
||||
invite: Vec::new(),
|
||||
invite_3pid: Vec::new(),
|
||||
is_direct: None,
|
||||
name: None,
|
||||
power_level_content_override: None,
|
||||
preset: None,
|
||||
room_alias_name: None,
|
||||
room_version: None,
|
||||
topic: None,
|
||||
visibility: None,
|
||||
}
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ impl Response {
|
||||
}
|
||||
|
||||
/// Categories of events that can be searched for.
|
||||
#[derive(Clone, Debug, Outgoing, Serialize)]
|
||||
#[derive(Clone, Debug, Default, Outgoing, Serialize)]
|
||||
#[non_exhaustive]
|
||||
pub struct Categories<'a> {
|
||||
/// Criteria for searching room events.
|
||||
@ -68,7 +68,7 @@ pub struct Categories<'a> {
|
||||
impl<'a> Categories<'a> {
|
||||
/// Creates an empty `Categories`.
|
||||
pub fn new() -> Self {
|
||||
Self { room_events: None }
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,6 +23,7 @@ ruma_api! {
|
||||
pub user_id: &'a UserId,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// The Matrix user ID of the user.
|
||||
@ -47,7 +48,7 @@ impl<'a> Request<'a> {
|
||||
impl Response {
|
||||
/// Creates an empty `Response`.
|
||||
pub fn new() -> Self {
|
||||
Self { user_id: None, devices: BTreeMap::new() }
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ ruma_api! {
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
|
@ -12,9 +12,11 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -12,9 +12,11 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
response: {}
|
||||
|
||||
|
@ -24,6 +24,7 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// A filter represented either as its full JSON definition or the ID of a saved filter.
|
||||
@ -98,13 +99,7 @@ ruma_api! {
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates an empty `Request`.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
filter: None,
|
||||
since: None,
|
||||
full_state: false,
|
||||
set_presence: Default::default(),
|
||||
timeout: None,
|
||||
}
|
||||
Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ ruma_api! {
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
|
@ -14,6 +14,7 @@ ruma_api! {
|
||||
requires_authentication: false,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user