pub struct SlidingSyncBuilder { /* private fields */ }
experimental-sliding-sync
only.Expand description
Configuration for a Sliding Sync instance.
Get a new builder with methods like crate::Client::sliding_sync
, or
crate::SlidingSync::builder
.
Implementations§
Source§impl SlidingSyncBuilder
impl SlidingSyncBuilder
Sourcepub fn version(self, version: Version) -> Self
pub fn version(self, version: Version) -> Self
Set a specific version that will override the one from the Client
.
Sourcepub fn add_list(self, list_builder: SlidingSyncListBuilder) -> Self
pub fn add_list(self, list_builder: SlidingSyncListBuilder) -> Self
Add the given list to the lists.
Replace any list with the same name.
Sourcepub async fn add_cached_list(self, list: SlidingSyncListBuilder) -> Result<Self>
pub async fn add_cached_list(self, list: SlidingSyncListBuilder) -> Result<Self>
Enroll the list in caching, reloads it from the cache if possible, and adds it to the list of lists.
This will raise an error if there was a I/O error reading from the cache.
Replace any list with the same name.
Sourcepub fn with_all_extensions(self) -> Self
pub fn with_all_extensions(self) -> Self
Activate e2ee, to-device-message, account data, typing and receipt extensions if not yet configured.
Will leave any extension configuration found untouched, so the order does not matter.
Sourcepub fn with_e2ee_extension(self, e2ee: E2EE) -> Self
pub fn with_e2ee_extension(self, e2ee: E2EE) -> Self
Set the E2EE extension configuration.
Sourcepub fn without_e2ee_extension(self) -> Self
pub fn without_e2ee_extension(self) -> Self
Unset the E2EE extension configuration.
Sourcepub fn with_to_device_extension(self, to_device: ToDevice) -> Self
pub fn with_to_device_extension(self, to_device: ToDevice) -> Self
Set the ToDevice extension configuration.
Sourcepub fn without_to_device_extension(self) -> Self
pub fn without_to_device_extension(self) -> Self
Unset the ToDevice extension configuration.
Sourcepub fn with_account_data_extension(self, account_data: AccountData) -> Self
pub fn with_account_data_extension(self, account_data: AccountData) -> Self
Set the account data extension configuration.
Sourcepub fn without_account_data_extension(self) -> Self
pub fn without_account_data_extension(self) -> Self
Unset the account data extension configuration.
Sourcepub fn with_typing_extension(self, typing: Typing) -> Self
pub fn with_typing_extension(self, typing: Typing) -> Self
Set the Typing extension configuration.
Sourcepub fn without_typing_extension(self) -> Self
pub fn without_typing_extension(self) -> Self
Unset the Typing extension configuration.
Sourcepub fn with_receipt_extension(self, receipt: Receipts) -> Self
pub fn with_receipt_extension(self, receipt: Receipts) -> Self
Set the Receipt extension configuration.
Sourcepub fn without_receipt_extension(self) -> Self
pub fn without_receipt_extension(self) -> Self
Unset the Receipt extension configuration.
Sourcepub fn poll_timeout(self, timeout: Duration) -> Self
pub fn poll_timeout(self, timeout: Duration) -> Self
Sets a custom timeout duration for the sliding sync polling endpoint.
This is the maximum time to wait before the sliding sync server returns the long-polling request. If no events (or other data) become available before this time elapses, the server will a return a response with empty fields.
There’s an additional network timeout on top of that that can be
configured with Self::network_timeout
.
Sourcepub fn network_timeout(self, timeout: Duration) -> Self
pub fn network_timeout(self, timeout: Duration) -> Self
Sets a custom network timeout for the sliding sync polling.
This is not the polling timeout that can be configured with
Self::poll_timeout
, but an additional timeout that will be
added to the former.
Available on crate feature e2e-encryption
only.
e2e-encryption
only.Should the sliding sync instance share its sync position through storage?
In general, sliding sync instances will cache the sync position (pos
field in the request) in internal memory. It can be useful, in
multi-process scenarios, to save it into some shared storage so that one
sliding sync instance running across two different processes can
continue with the same sync position it had before being stopped.
Sourcepub async fn build(self) -> Result<SlidingSync>
pub async fn build(self) -> Result<SlidingSync>
Build the Sliding Sync.
If self.storage_key
is Some(_)
, load the cached data from cold
storage.
Trait Implementations§
Source§impl Clone for SlidingSyncBuilder
impl Clone for SlidingSyncBuilder
Source§fn clone(&self) -> SlidingSyncBuilder
fn clone(&self) -> SlidingSyncBuilder
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 SlidingSyncBuilder
impl !RefUnwindSafe for SlidingSyncBuilder
impl Send for SlidingSyncBuilder
impl Sync for SlidingSyncBuilder
impl Unpin for SlidingSyncBuilder
impl !UnwindSafe for SlidingSyncBuilder
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> 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