pub struct SpaceService { /* private fields */ }
Expand description
The main entry point into the Spaces facilities.
The spaces service is responsible for retrieving one’s joined rooms,
building a graph out of their m.space.parent
and m.space.child
state
events, and providing access to the top-level spaces and their children.
§Examples
use futures_util::StreamExt;
use matrix_sdk::Client;
use matrix_sdk_ui::spaces::SpaceService;
use ruma::owned_room_id;
let space_service = SpaceService::new(client.clone());
// Get a list of all the joined spaces
let joined_spaces = space_service.joined_spaces().await;
// And subscribe to changes on them
// `initial_values` is equal to `joined_spaces` if nothing changed meanwhile
let (initial_values, stream) =
space_service.subscribe_to_joined_spaces().await;
while let Some(diffs) = stream.next().await {
println!("Received joined spaces updates: {diffs:?}");
}
// Get a list of all the rooms in a particular space
let room_list = space_service
.space_room_list(owned_room_id!("!some_space:example.org"));
// Which can be used to retrieve information about the children rooms
let children = room_list.rooms();
Implementations§
Source§impl SpaceService
impl SpaceService
Sourcepub async fn subscribe_to_joined_spaces(
&self,
) -> (Vector<SpaceRoom>, VectorSubscriberBatchedStream<SpaceRoom>)
pub async fn subscribe_to_joined_spaces( &self, ) -> (Vector<SpaceRoom>, VectorSubscriberBatchedStream<SpaceRoom>)
Subscribes to updates on the joined spaces list. If space rooms are joined or left, the stream will yield diffs that reflect the changes.
Sourcepub async fn joined_spaces(&self) -> Vec<SpaceRoom>
pub async fn joined_spaces(&self) -> Vec<SpaceRoom>
Returns a list of all the top-level joined spaces. It will eagerly compute the latest version and also notify subscribers if there were any changes.
Sourcepub fn space_room_list(&self, space_id: OwnedRoomId) -> SpaceRoomList
pub fn space_room_list(&self, space_id: OwnedRoomId) -> SpaceRoomList
Returns a SpaceRoomList
for the given space ID.
Auto Trait Implementations§
impl !Freeze for SpaceService
impl !RefUnwindSafe for SpaceService
impl Send for SpaceService
impl Sync for SpaceService
impl Unpin for SpaceService
impl !UnwindSafe for SpaceService
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
Mutably borrows from an owned value. Read more
§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>
Converts
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>
Converts
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)
Converts
&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)
Converts
&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§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
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>
Converts
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>
Converts
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