client-api: Move Direction to the root of the crate
This commit is contained in:
parent
994136b9b8
commit
e2e123dd89
@ -6,6 +6,7 @@ Breaking changes:
|
||||
* Use `sync::sync_events::DeviceLists` instead
|
||||
* `fully_read` field in `read_marker::set_read_marker` is no longer required
|
||||
* Remove the `fully_read` argument from `read_marker::set_read_marker::Request::new`
|
||||
* Move `message::get_message_events::v3::Direction` to the root of the crate
|
||||
|
||||
Improvements:
|
||||
|
||||
|
@ -51,6 +51,7 @@ pub mod voip;
|
||||
use std::fmt;
|
||||
|
||||
pub use error::Error;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
// Wrapper around `Box<str>` that cannot be used in a meaningful way outside of
|
||||
// this crate. Used for string enums because their `_Custom` variant can't be
|
||||
@ -64,3 +65,17 @@ impl fmt::Debug for PrivOwnedStr {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
/// The direction to return events from.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Deserialize, Serialize)]
|
||||
#[allow(clippy::exhaustive_enums)]
|
||||
pub enum Direction {
|
||||
/// Return events backwards in time from the requested `from` token.
|
||||
#[default]
|
||||
#[serde(rename = "b")]
|
||||
Backward,
|
||||
|
||||
/// Return events forwards in time from the requested `from` token.
|
||||
#[serde(rename = "f")]
|
||||
Forward,
|
||||
}
|
||||
|
@ -12,9 +12,11 @@ pub mod v3 {
|
||||
serde::Raw,
|
||||
RoomId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::filter::{IncomingRoomEventFilter, RoomEventFilter};
|
||||
use crate::{
|
||||
filter::{IncomingRoomEventFilter, RoomEventFilter},
|
||||
Direction,
|
||||
};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -169,19 +171,6 @@ pub mod v3 {
|
||||
*val == default_limit()
|
||||
}
|
||||
|
||||
/// The direction to return events from.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[allow(clippy::exhaustive_enums)]
|
||||
pub enum Direction {
|
||||
/// Return events backwards in time from the requested `from` token.
|
||||
#[serde(rename = "b")]
|
||||
Backward,
|
||||
|
||||
/// Return events forwards in time from the requested `from` token.
|
||||
#[serde(rename = "f")]
|
||||
Forward,
|
||||
}
|
||||
|
||||
#[cfg(all(test, feature = "client"))]
|
||||
mod tests {
|
||||
use js_int::uint;
|
||||
@ -190,8 +179,11 @@ pub mod v3 {
|
||||
room_id,
|
||||
};
|
||||
|
||||
use super::{Direction, Request};
|
||||
use crate::filter::{LazyLoadOptions, RoomEventFilter};
|
||||
use super::Request;
|
||||
use crate::{
|
||||
filter::{LazyLoadOptions, RoomEventFilter},
|
||||
Direction,
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn serialize_some_room_event_filter() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user