Struct ockam::channel::ChannelBuilder
source · [−]pub struct ChannelBuilder { /* private fields */ }
Expand description
Generalised ockam channel API
Implementations
sourceimpl ChannelBuilder
impl ChannelBuilder
sourcepub async fn new(ctx: &Context) -> Result<Self>
pub async fn new(ctx: &Context) -> Result<Self>
Create a new Ockam channel context
let builder = ChannelBuilder::new(ctx).await?;
// Create a new channel listener
builder.create_channel_listener("my-channel-listener").await?;
// Connect a channel to the listener
let ch = builder.connect(vec!["my-channel-listener"]).await?;
ctx.send(ch.tx().append("app"), String::from("Hello via channel!")).await?;
// Wait for the reply message
let msg = ctx.receive::<String>().await?;
println!("Received message '{}'", msg);
sourcepub fn attach_tx_behavior<B: BehaviorHook + Clone + Send + Sync + 'static>(
self,
bev: B
) -> Self
pub fn attach_tx_behavior<B: BehaviorHook + Clone + Send + Sync + 'static>(
self,
bev: B
) -> Self
Attach a new behavior to be used by the underlying pipe sender
sourcepub fn attach_rx_behavior<B: BehaviorHook + Clone + Send + Sync + 'static>(
self,
bev: B
) -> Self
pub fn attach_rx_behavior<B: BehaviorHook + Clone + Send + Sync + 'static>(
self,
bev: B
) -> Self
Attach a new behavior to be used by the underlying pipe receiver
Auto Trait Implementations
impl !RefUnwindSafe for ChannelBuilder
impl Send for ChannelBuilder
impl Sync for ChannelBuilder
impl Unpin for ChannelBuilder
impl !UnwindSafe for ChannelBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more