Struct matrix_sdk::room::MessagesOptions
source · #[non_exhaustive]pub struct MessagesOptions {
pub from: Option<String>,
pub to: Option<String>,
pub dir: Direction,
pub limit: UInt,
pub filter: RoomEventFilter,
}
Expand description
Options for messages
.
See that method and https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3roomsroomidmessages for details.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.from: Option<String>
The token to start returning events from.
This token can be obtained from a prev_batch
token returned for each
room from the sync API, or from a start or end token returned by a
previous messages
call.
If from
isn’t provided the homeserver shall return a list of messages
from the first or last (per the value of the dir parameter) visible
event in the room history for the requesting user.
to: Option<String>
The token to stop returning events at.
This token can be obtained from a prev_batch
token returned for each
room by the sync API, or from a start or end token returned by a
previous messages
call.
dir: Direction
The direction to return events in.
limit: UInt
The maximum number of events to return.
Default: 10.
filter: RoomEventFilter
A RoomEventFilter
to filter returned events with.
Implementations§
source§impl MessagesOptions
impl MessagesOptions
sourcepub fn new(dir: Direction) -> Self
pub fn new(dir: Direction) -> Self
Creates MessagesOptions
with the given direction.
All other parameters will be defaulted.
sourcepub fn backward() -> Self
pub fn backward() -> Self
Creates MessagesOptions
with dir
set to Backward
.
If no from
token is set afterwards, pagination will start at the
end of (the accessible part of) the room timeline.
sourcepub fn forward() -> Self
pub fn forward() -> Self
Creates MessagesOptions
with dir
set to Forward
.
If no from
token is set afterwards, pagination will start at the
beginning of (the accessible part of) the room timeline.
sourcepub fn from<'a>(self, from: impl Into<Option<&'a str>>) -> Self
pub fn from<'a>(self, from: impl Into<Option<&'a str>>) -> Self
Creates a new MessagesOptions
from self
with the from
field set to
the given value.
Since the field is public, you can also assign to it directly. This method merely acts as a shorthand for that, because it is very common to set this field.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessagesOptions
impl RefUnwindSafe for MessagesOptions
impl Send for MessagesOptions
impl Sync for MessagesOptions
impl Unpin for MessagesOptions
impl UnwindSafe for MessagesOptions
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more