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>
impl<V: Value + ?Sized> ValueChannel<V>
Sourcepub fn put_ref(&mut self, data: &V) -> Result<Put<'_>, Error>
pub fn put_ref(&mut self, data: &V) -> Result<Put<'_>, Error>
Write value by reference to the channel.
Sourcepub fn get_with<F>(&mut self, func: F) -> Get<'_, F> ⓘwhere
F: Callback<Request = V>,
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.
Sourcepub fn subscribe_with<F: Queue<Request = V>>(
&mut self,
func: F,
) -> Subscription<'_, F>
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]>
impl<T: Field> ValueChannel<[T]>
Sourcepub fn get_vec(&mut self) -> Get<'_, GetFn<[T], Vec<T>>> ⓘ
pub fn get_vec(&mut self) -> Get<'_, GetFn<[T], Vec<T>>> ⓘ
Request array value and store it in Vec.
Sourcepub fn get_to_slice<'a, 'b>(
&'a mut self,
dst: &'b mut [T],
) -> Get<'a, GetToSlice<'b, T>> ⓘ
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).
Sourcepub fn subscribe_vec(&mut self) -> Subscription<'_, LastFn<[T], Vec<T>>>
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>
impl<T: Field> ValueChannel<T>
Sourcepub fn subscribe(&mut self) -> Subscription<'_, LastFn<T, T>>
pub fn subscribe(&mut self) -> Subscription<'_, LastFn<T, T>>
Subscribe to updates of scalar value.
Sourcepub fn subscribe_buffered(&mut self) -> Subscription<'_, QueueFn<T, T>>
pub fn subscribe_buffered(&mut self) -> Subscription<'_, QueueFn<T, T>>
Subscribe to updates of scalar value and store all updates.
Methods from Deref<Target = TypedChannel<V>>§
Sourcepub fn put_ref<R>(&mut self, req: &R) -> Result<Put<'_>, Error>
pub fn put_ref<R>(&mut self, req: &R) -> Result<Put<'_>, Error>
Make write request by reference.
Sourcepub fn get_with<R, F>(&mut self, func: F) -> Get<'_, F> ⓘ
pub fn get_with<R, F>(&mut self, func: F) -> Get<'_, F> ⓘ
Make read request and call closure when it’s done, successfully or not.
Sourcepub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>
pub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>
Subscribe to channel updates and call closure each time when update occured.
Sourcepub fn put<R>(&mut self, req: R) -> Result<Put<'_>, Error>where
R: TypedRequest<Value = T> + WriteRequest,
pub fn put<R>(&mut self, req: R) -> Result<Put<'_>, Error>where
R: TypedRequest<Value = T> + WriteRequest,
Write scalar request.
Sourcepub fn subscribe<R>(&mut self) -> Subscription<'_, LastFn<R, R>>
pub fn subscribe<R>(&mut self) -> Subscription<'_, LastFn<R, R>>
Subscribe to updates of scalar channel.
Note, that returned stream stores only last unread value.
To store all values use Self::subscribe_buffered.
Sourcepub fn subscribe_buffered<R>(&mut self) -> Subscription<'_, QueueFn<R, R>>
pub fn subscribe_buffered<R>(&mut self) -> Subscription<'_, QueueFn<R, R>>
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>§
Sourcepub fn field_type(&self) -> Result<FieldId, Error>
pub fn field_type(&self) -> Result<FieldId, Error>
Channel field type.
Sourcepub fn element_count(&self) -> Result<usize, Error>
pub fn element_count(&self) -> Result<usize, Error>
Number of elements in the channel.
Sourcepub fn put_ref<R: WriteRequest + ?Sized>(
&mut self,
req: &R,
) -> Result<Put<'_>, Error>
pub fn put_ref<R: WriteRequest + ?Sized>( &mut self, req: &R, ) -> Result<Put<'_>, Error>
Make write request by reference.
Sourcepub fn get_with<F: Callback>(&mut self, func: F) -> Get<'_, F> ⓘ
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.
Sourcepub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>
pub fn subscribe_with<F: Queue>(&mut self, func: F) -> Subscription<'_, F>
Subscribe to channel updates and call closure each time when update occured.