Struct netidx::publisher::Val[][src]

pub struct Val(_);

This represents a published value. Internally it is wrapped in an Arc, so cloning it is free. When all references to a given published value have been dropped it will be unpublished. However you must call flush before references to it will be removed from the resolver server.

Implementations

impl Val[src]

pub fn downgrade(&self) -> ValWeak[src]

pub fn update(&self, v: Value)[src]

Queue an update to the published value, it will not be sent out until you call flush on the publisher, however new subscribers will receive the last value passed to update when they subscribe regardless of flush. Multiple updates can be queued before flush is called, in which case on flush subscribers will receive all the queued values in order. If updates are queued on multiple different published values before flush is called, they will all be sent out as a batch and are guarenteed to arrive in the order update was called.

pub fn update_changed(&self, v: Value)[src]

update the current value only if the new value is different from the existing one. Otherwise exactly the same as update.

pub fn update_subscriber(&self, subscriber: &SocketAddr, v: Value)[src]

Send v as an update ONLY to the specified subscriber, and do not update current. You can use this to implement a simple unicast side channel in parallel with the existing multicast update mechanism.

One example use for this function is implementing a query response value, where the query is encoded in the name of the value (perhaps passed via publish_default), and the full response set is sent to each client as it subscribes.

pub fn writes(&self, tx: Sender<Pooled<Vec<WriteRequest>>>)[src]

Register tx to receive writes. You can register multiple channels, and you can register the same channel on multiple Val objects. If no channels are registered to receive writes they will return an error to the subscriber.

If the send_result struct member of WriteRequest is set then the client has requested that an explicit reply be made to the write. In that case the included SendReply object can be used to send the reply back to the write client. If the SendReply object is dropped without any reply being sent then Value::Ok will be sent. SendReply::send may only be called once, further calls will be silently ignored.

If you no longer wish to accept writes, simply drop all registered channels.

pub fn subscribers(
    &self,
    include_existing: bool,
    tx: UnboundedSender<(Id, SocketAddr)>
)
[src]

Register tx to receive a message when a new client subscribes to this value. If include_existing is true, then current subscribers will be sent to the channel immediatly, otherwise it will only receive new subscribers.

pub fn unsubscribe(&self, subscriber: &SocketAddr)[src]

Unsubscribe the specified client.

pub fn current(&self) -> Value[src]

Get a copy of the current value

pub fn id(&self) -> Id[src]

Get the unique Id of this Val

pub fn path(&self) -> &Path[src]

Get a reference to the Path of this published value.

pub fn subscribed(&self) -> Vec<SocketAddr>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

pub fn subscribed_len(&self) -> usize[src]

Trait Implementations

impl Clone for Val[src]

Auto Trait Implementations

impl !RefUnwindSafe for Val

impl Send for Val

impl Sync for Val

impl Unpin for Val

impl !UnwindSafe for Val

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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