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