dittolive_ditto::sync

Struct Sync

Source
pub struct Sync { /* private fields */ }
Expand description

Implementations§

Source§

impl Sync

Source

pub fn subscriptions_v2(&self) -> HashSet<SyncSubscription>

Returns a snapshot of handles to all active SyncSubscriptions.

Adding or removing SyncSubscriptions from this map will not cause the underlying subscriptions to be updated.

§Example
let subscription = ditto
    .sync()
    .register_subscription("SELECT * FROM cars", None)?;
let subscriptions = ditto.sync().subscriptions_v2();
assert!(subscriptions.contains(&subscription));
Source

pub fn register_subscription_v2<Q>( &self, query: Q, ) -> Result<Arc<SyncSubscription>, DittoError>
where Q: IntoQuery, Q::Args: Serialize,

Use a DQL query to subscribe to data on other Ditto peers.

While the subscription is active, data matching this query on other peers will be synced to the local peer’s data store.

Note that dropping the SyncSubscription won’t cancel it, to do that be sure to use sync_subscription.cancel().

§Example
use dittolive_ditto::prelude::*;
let query = (
    "SELECT * FROM cars WHERE color = :color",
    serde_json::json!({"color": "blue"}),
);

let sync_subscription = ditto.sync().register_subscription_v2(query)?;

// Cancel the subscription with `.cancel()`
sync_subscription.cancel();

Auto Trait Implementations§

§

impl Freeze for Sync

§

impl !RefUnwindSafe for Sync

§

impl Send for Sync

§

impl Sync for Sync

§

impl Unpin for Sync

§

impl !UnwindSafe for Sync

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
§

impl<T> FitForCBox for T

§

type CBoxWrapped = Box_<T>

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ManuallyDropMut for T

§

type Ret = ManuallyDrop<T>

§

fn manually_drop_mut<'__>(&'__ mut self) -> &'__ mut ManuallyDrop<T>

§

impl<T> To for T
where T: ?Sized,

§

fn to<T>(self) -> T
where Self: Into<T>,

Converts to T by calling Into<T>::into.
§

fn try_to<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Tries to convert to T by calling TryInto<T>::try_into.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<F> ZeroSizedElseWrathOfTheGඞds for F