Channel

Struct Channel 

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

Basic channel.

Channel is an entity that has a name and could be read, written or subscribed to.

Implementations§

Source§

impl Channel

Source

pub fn new(ctx: &Context, name: &CStr) -> Result<Self, Error>

Create channel without waiting for connection.

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§

impl 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.

Source§

impl Channel

Source

pub fn into_typed<V: Value + ?Sized>( self, ) -> Result<TypedChannel<V>, (Error, Self)>

Convert into TypedChannel.

Conversion is successful if actual channel type matches the one passed as a parameter V.

Trait Implementations§

Source§

impl Debug for Channel

Source§

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

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

impl Drop for Channel

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

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

Source§

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

Converts to this type from the input type.
Source§

impl Send for Channel
where Context: Send,

Auto Trait Implementations§

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<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.