ValueChannel

Struct ValueChannel 

Source
pub struct ValueChannel<V: Value + ?Sized> { /* private fields */ }
Expand description

Channel used to read and write only value rather than other requests.

Implementations§

Source§

impl<V: Value + ?Sized> ValueChannel<V>

Source

pub fn put_ref(&mut self, data: &V) -> Result<Put<'_>, Error>

Write value by reference to the channel.

Source

pub fn get_with<F>(&mut self, func: F) -> Get<'_, F>
where F: Callback<Request = V>,

Request value from the channel and call callback when it’s done.

Source

pub fn subscribe_with<F: Queue<Request = V>>( &mut self, func: F, ) -> Subscription<'_, F>

Subscribe to value updates and call closure each time when update occured.

Source§

impl<T: Field> ValueChannel<[T]>

Source

pub fn get_vec(&mut self) -> Get<'_, GetFn<[T], Vec<T>>>

Request array value and store it in Vec.

Source

pub fn get_to_slice<'a, 'b>( &'a mut self, dst: &'b mut [T], ) -> Get<'a, GetToSlice<'b, T>>

Write value to slice and return received value length (which may be greater than dst length).

Source

pub fn subscribe_vec(&mut self) -> Subscription<'_, LastFn<[T], Vec<T>>>

Subscribe to array value updates and obtain Vec stream.

Source§

impl<T: Field> ValueChannel<T>

Source

pub fn put(&mut self, val: T) -> Result<Put<'_>, Error>

Write scalar value.

Source

pub fn get(&mut self) -> Get<'_, GetFn<T, T>>

Get scalar value.

Source

pub fn subscribe(&mut self) -> Subscription<'_, LastFn<T, T>>

Subscribe to updates of scalar value.

See TypedChannel::subscribe.

Source

pub fn subscribe_buffered(&mut self) -> Subscription<'_, QueueFn<T, T>>

Subscribe to updates of scalar value and store all updates.

See TypedChannel::subscribe_buffered.

Methods from Deref<Target = TypedChannel<V>>§

Source

pub fn put_ref<R>(&mut self, req: &R) -> Result<Put<'_>, Error>
where R: TypedRequest<Value = V> + WriteRequest + ?Sized,

Make write request by reference.

Source

pub fn get_with<R, F>(&mut self, func: F) -> Get<'_, F>
where R: TypedRequest<Value = V> + ReadRequest + ?Sized, F: Callback<Request = R>,

Make read request and call closure when it’s done, successfully or not.

Source

pub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>
where F::Request: TypedRequest<Value = V> + ReadRequest,

Subscribe to channel updates and call closure each time when update occured.

Source

pub fn put<R>(&mut self, req: R) -> Result<Put<'_>, Error>
where R: TypedRequest<Value = T> + WriteRequest,

Write scalar request.

Source

pub fn get<R>(&mut self) -> Get<'_, GetFn<R, R>>
where R: TypedRequest<Value = T> + ReadRequest + Copy,

Get result of scalar read request.

Source

pub fn subscribe<R>(&mut self) -> Subscription<'_, LastFn<R, R>>
where R: TypedRequest<Value = T> + ReadRequest + Copy,

Subscribe to updates of scalar channel.

Note, that returned stream stores only last unread value. To store all values use Self::subscribe_buffered.

Source

pub fn subscribe_buffered<R>(&mut self) -> Subscription<'_, QueueFn<R, R>>
where R: TypedRequest<Value = T> + ReadRequest + Copy,

Subscribe to updates of scalar channel and store all updates.

This subscription contains internal buffer that can grow up to arbitrary size especially in case of frequent channel updates.

Methods from Deref<Target = Channel>§

Source

pub fn connected(&mut self) -> Connect<'_>

Wait for channel become connected.

Source

pub fn context(&self) -> &Context

Context of the channel.

Source

pub fn raw(&self) -> chanId

Raw channed identifier.

Source

pub fn name(&self) -> &CStr

Channel name.

Source

pub fn field_type(&self) -> Result<FieldId, Error>

Channel field type.

Source

pub fn element_count(&self) -> Result<usize, Error>

Number of elements in the channel.

Source

pub fn host_name(&self) -> Result<&CStr, Error>

Name of the host which serves the channel.

Source

pub fn put_ref<R: WriteRequest + ?Sized>( &mut self, req: &R, ) -> Result<Put<'_>, Error>

Make write request by reference.

Source

pub fn get_with<F: Callback>(&mut self, func: F) -> Get<'_, F>

Make read request and call closure when it’s done, successfully or not.

Source

pub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>

Subscribe to channel updates and call closure each time when update occured.

Trait Implementations§

Source§

impl<V: Value + ?Sized> Debug for ValueChannel<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V: Value + ?Sized> Deref for ValueChannel<V>

Source§

type Target = TypedChannel<V>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<V: Value + ?Sized> DerefMut for ValueChannel<V>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<V: Value + ?Sized> From<TypedChannel<V>> for ValueChannel<V>

Source§

fn from(original: TypedChannel<V>) -> ValueChannel<V>

Converts to this type from the input type.
Source§

impl<V: Value + ?Sized> From<ValueChannel<V>> for TypedChannel<V>

Source§

fn from(original: ValueChannel<V>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<V> Freeze for ValueChannel<V>
where V: ?Sized,

§

impl<V> RefUnwindSafe for ValueChannel<V>
where V: RefUnwindSafe + ?Sized,

§

impl<V> Send for ValueChannel<V>
where V: ?Sized,

§

impl<V> !Sync for ValueChannel<V>

§

impl<V> Unpin for ValueChannel<V>
where V: Unpin + ?Sized,

§

impl<V> UnwindSafe for ValueChannel<V>
where V: UnwindSafe + ?Sized,

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.