Struct Channel

Source
pub struct Channel(/* private fields */);
Expand description

A channel in a remote FDomain.

Implementations§

Source§

impl Channel

Source

pub fn recv_msg(&self) -> impl Future<Output = Result<MessageBuf, Error>>

Reads a message from the channel.

Source

pub fn recv_from( &self, cx: &mut Context<'_>, buf: &mut MessageBuf, ) -> Poll<Result<(), Error>>

Poll a channel for a message to read.

Source

pub fn write(&self, bytes: &[u8], handles: Vec<Handle>) -> Result<(), Error>

Writes a message into the channel.

Source

pub fn fdomain_write( &self, bytes: &[u8], handles: Vec<Handle>, ) -> impl Future<Output = Result<(), Error>> + '_

Writes a message into the channel. Returns a future that will allow you to wait for the write to move across the FDomain connection and return with the result of the actual write call on the target.

Source

pub fn on_closed(&self) -> OnFDomainSignals

A future that returns when the channel is closed.

Source

pub fn is_closed(&self) -> bool

Whether this handle is closed.

Source

pub fn fdomain_write_etc<'b>( &self, bytes: &[u8], handles: Vec<HandleOp<'b>>, ) -> impl Future<Output = Result<(), Error>> + 'b

Writes a message into the channel. Optionally duplicates some of the handles rather than consuming them, and can update the handle’s rights before sending.

Source

pub fn stream(self) -> Result<(ChannelMessageStream, ChannelWriter), Error>

Split this channel into a streaming reader and a writer. This is more efficient on the read side if you intend to consume all of the messages from the channel. However it will prevent you from transferring the handle in the future. It also means messages will build up in the buffer, so it may lead to memory issues if you don’t intend to use the messages from the channel as fast as they come.

Trait Implementations§

Source§

impl AsHandleRef for Channel

Source§

fn as_handle_ref(&self) -> HandleRef<'_>

Source§

fn object_type() -> ObjectType

Source§

fn signal_handle( &self, set: Signals, clear: Signals, ) -> impl Future<Output = Result<(), Error>>

Source§

fn domain(&self) -> Arc<Client>

Get the client supporting this handle. See fidl::Proxy::domain.
Source§

impl ChannelLike for Channel

Source§

fn write_epitaph(&self, bytes: &[u8]) -> Result<(), TransportError>

Write an epitaph to a channel. Same as write_etc but is never fed handles.
Source§

impl Debug for Channel

Source§

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

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

impl EncodableAsHandle for Channel

Source§

type Dialect = FDomainResourceDialect

What resource dialect can encode this object as a handle.
Source§

impl<T: ProtocolMarker> From<Channel> for ClientEnd<T>

Source§

fn from(chan: Channel) -> Self

Converts to this type from the input type.
Source§

impl From<Channel> for Handle

Source§

fn from(other: Channel) -> Handle

Converts to this type from the input type.
Source§

impl<T: ProtocolMarker> From<Channel> for ServerEnd<T>

Source§

fn from(chan: Channel) -> Self

Converts to this type from the input type.
Source§

impl From<Handle> for Channel

Source§

fn from(other: Handle) -> Channel

Converts to this type from the input type.
Source§

impl HandleBased for Channel

Source§

fn close(self) -> impl Future<Output = Result<(), Error>>

Closes this handle. Surfaces errors that dropping the handle will not.
Source§

fn duplicate_handle( &self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>

Duplicate this handle.
Source§

fn replace_handle( self, rights: Rights, ) -> impl Future<Output = Result<Self, Error>>

Replace this handle with an equivalent one with different rights.
Source§

fn into_handle(self) -> Handle

Convert this handle-based value into a pure Handle.
Source§

fn from_handle(handle: Handle) -> Self

Construct a new handle-based value from a Handle.
Source§

fn into_handle_based<H: HandleBased>(self) -> H

Turn this handle-based value into one of a different type.
Source§

fn from_handle_based<H: HandleBased>(h: H) -> Self

Turn another handle-based type into this one.
Source§

impl Hash for Channel

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Channel

Source§

fn cmp(&self, other: &Channel) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Channel

Source§

fn eq(&self, other: &Channel) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Channel

Source§

fn partial_cmp(&self, other: &Channel) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Peered for Channel

Source§

fn signal_peer( &self, set: Signals, clear: Signals, ) -> impl Future<Output = Result<(), Error>>

Assert and deassert signals on this handle’s peer.
Source§

impl ProxyChannelFor<FDomainResourceDialect> for Channel

Source§

type Boxed = FDomainProxyChannel

Box we put around a ProxyChannel when using it within a client.
Source§

type Error = Error

Type of the errors we get from this proxy channel.
Source§

type HandleDisposition = HandleInfo

Handle disposition used in this dialect. Read more
Source§

fn boxed(self) -> Self::Boxed

Construct a new box around a proxy channel.
Source§

fn write_etc( &self, bytes: &[u8], handles: &mut [HandleInfo], ) -> Result<(), Option<Error>>

Write data to a Proxy channel
Source§

impl Eq for Channel

Source§

impl StructuralPartialEq for Channel

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
§

impl<T> ChannelEpitaphExt for T
where T: ChannelLike,

§

fn close_with_epitaph(self, status: Status) -> Result<(), Error>

Consumes the channel and writes an epitaph.
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. 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.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V