pub struct LiveLocationState { /* private fields */ }Expand description
The state of a live location sharing session.
Created when a org.matrix.msc3672.beacon_info state event is received.
Subsequent org.matrix.msc3672.beacon message-like events are aggregated
onto this item, appending to LiveLocationState::locations.
When a user stops sharing (a new beacon_info with live: false arrives)
a separate timeline item is created for the stop event. The original
item’s liveness can be checked via LiveLocationState::is_live, which
internally checks both the live flag and the session timeout.
Implementations§
Source§impl LiveLocationState
impl LiveLocationState
Sourcepub fn new(beacon_info: BeaconInfoEventContent) -> Self
pub fn new(beacon_info: BeaconInfoEventContent) -> Self
Create a new LiveLocationState from the given
[BeaconInfoEventContent].
Sourcepub fn locations(&self) -> &[BeaconInfo]
pub fn locations(&self) -> &[BeaconInfo]
All accumulated location updates, sorted by timestamp (oldest first).
Sourcepub fn latest_location(&self) -> Option<&BeaconInfo>
pub fn latest_location(&self) -> Option<&BeaconInfo>
The most recent location update, if any have been received.
Sourcepub fn is_live(&self) -> bool
pub fn is_live(&self) -> bool
Whether this live location share is still active.
Returns false once the live flag has been set to false or
the session’s timeout has elapsed.
Sourcepub fn description(&self) -> Option<&str>
pub fn description(&self) -> Option<&str>
An optional human-readable description for this sharing session
(from the originating beacon_info event).
Sourcepub fn timeout(&self) -> Duration
pub fn timeout(&self) -> Duration
The duration that the location sharing will be live.
Meaning that the location will stop being shared at ts + timeout.
Sourcepub fn asset_type(&self) -> AssetType
pub fn asset_type(&self) -> AssetType
The asset type of the beacon (e.g. Sender for the user’s own
location, Pin for a fixed point of interest).
Trait Implementations§
Source§impl Clone for LiveLocationState
impl Clone for LiveLocationState
Source§fn clone(&self) -> LiveLocationState
fn clone(&self) -> LiveLocationState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LiveLocationState
impl RefUnwindSafe for LiveLocationState
impl Send for LiveLocationState
impl Sync for LiveLocationState
impl Unpin for LiveLocationState
impl UnsafeUnpin for LiveLocationState
impl UnwindSafe for LiveLocationState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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