#[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: DirectionThe direction to return events in.
limit: UIntThe maximum number of events to return.
Default: 10.
filter: RoomEventFilterA 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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
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