1pub mod base;
10pub mod get;
11pub mod put;
12pub mod subscribe;
13pub mod typed;
14pub mod value;
15
16pub use base::{Channel, Connect};
17pub use get::{Get, GetFn};
18pub use put::Put;
19pub use subscribe::Subscription;
20pub use typed::TypedChannel;
21pub use value::ValueChannel;
22
23use crate::{context::Context, error::Error, types::Value};
24use std::ffi::CStr;
25
26impl Context {
27 pub async fn connect<V: Value + ?Sized>(&self, name: &CStr) -> Result<ValueChannel<V>, Error> {
29 let mut chan = Channel::new(self, name)?;
30 chan.connected().await;
31 let typed = chan.into_typed::<V>().map_err(|(err, _)| err)?;
32 Ok(typed.into_value())
33 }
34}
35
36#[cfg(test)]
37mod tests;