ClientEnd

Struct ClientEnd 

Source
pub struct ClientEnd<P, T = <P as HasTransport>::Transport> { /* private fields */ }
Expand description

The client end of a protocol.

Implementations§

Source§

impl<P, T> ClientEnd<P, T>

Source

pub fn as_ref(&self) -> ClientEnd<P, &T>

Converts from &ClientEnd<P, T> to ClientEnd<P, &T>.

Source

pub fn from_untyped(transport: T) -> Self

Returns a new endpoint over the given transport.

Source

pub fn into_untyped(self) -> T

Returns the underlying transport.

Source

pub fn executor(&self) -> T::Executor
where T: HasExecutor,

Returns the executor for the underlying transport.

Source§

impl<P, T: Transport> ClientEnd<P, T>

Source

pub fn spawn_handler_full_on_with<H, E>( self, create_handler: impl FnOnce(Client<P, T>) -> H, executor: &E, ) -> (Client<P, T>, HandlerTask<T, H, E>)
where P: DispatchClientMessage<H, T>, T: 'static, H: Send + 'static, E: Executor,

Spawns a dispatcher for the given client end with a handler computed from a closure on an executor.

Returns the client and a join handle for the spawned task.

Source

pub fn spawn_handler_full_on<H, E>( self, handler: H, executor: &E, ) -> (Client<P, T>, HandlerTask<T, H, E>)
where P: DispatchClientMessage<H, T>, T: 'static, H: Send + 'static, E: Executor,

Spawns a dispatcher for the given client end with a handler on an executor.

Returns the client and a join handle for the spawned task.

Source

pub fn spawn_handler_on_with<H, E>( self, create_handler: impl FnOnce(Client<P, T>) -> H, executor: &E, ) -> Client<P, T>
where P: DispatchClientMessage<H, T>, T: 'static, H: Send + 'static, E: Executor,

Spawns a dispatcher for the given client end with a handler computed from a closure on an executor.

Returns the client.

Source

pub fn spawn_handler_on<H, E>(self, handler: H, executor: &E) -> Client<P, T>
where P: DispatchClientMessage<H, T>, T: 'static, H: Send + 'static, E: Executor,

Spawns a dispatcher for the given client end with a handler on an executor.

Returns the client.

Source

pub fn spawn_handler_full_with<H>( self, create_handler: impl FnOnce(Client<P, T>) -> H, ) -> (Client<P, T>, HandlerTask<T, H>)
where P: DispatchClientMessage<H, T>, T: HasExecutor + 'static, H: Send + 'static,

Spawns a dispatcher for the given client end with a handler computed from a closure on the default executor for the transport.

Returns the client and a join handle for the spawned task.

Source

pub fn spawn_handler_full<H>( self, handler: H, ) -> (Client<P, T>, HandlerTask<T, H>)
where P: DispatchClientMessage<H, T>, T: HasExecutor + 'static, H: Send + 'static,

Spawns a dispatcher for the given client end with a handler on the default executor for the transport.

Returns the client and a join handle for the spawned task.

Source

pub fn spawn_handler_with<H>( self, create_handler: impl FnOnce(Client<P, T>) -> H, ) -> Client<P, T>
where P: DispatchClientMessage<H, T>, T: HasExecutor + 'static, H: Send + 'static,

Spawns a dispatcher for the given client end with a handler computed from a closure on the default executor for the transport.

Returns the client.

Source

pub fn spawn_handler<H>(self, handler: H) -> Client<P, T>
where P: DispatchClientMessage<H, T>, T: HasExecutor + 'static, H: Send + 'static,

Spawns a dispatcher for the given client end with a handler on the default executor for the transport.

Returns the client.

Source

pub fn spawn_full_on<E>( self, executor: &E, ) -> (Client<P, T>, HandlerTask<T, (), E>)
where P: DispatchClientMessage<IgnoreEvents, T>, T: 'static, E: Executor,

Spawns a dispatcher for the given client end on an executor.

The spawned dispatcher will ignore all incoming events. Returns the client and a join handle for the spawned task.

Source

pub fn spawn_on<E>(self, executor: &E) -> Client<P, T>
where P: DispatchClientMessage<IgnoreEvents, T>, T: 'static, E: Executor,

Spawns a dispatcher for the given client end on an executor.

The spawned dispatcher will ignore all incoming events. Returns the client.

Source

pub fn spawn_full(self) -> (Client<P, T>, HandlerTask<T, ()>)
where P: DispatchClientMessage<IgnoreEvents, T>, T: HasExecutor + 'static,

Spawns a dispatcher for the given client end on the default executor for the transport.

The spawned dispatcher will ignore all incoming events. Returns the client and a join handle for the spawned task.

Source

pub fn spawn(self) -> Client<P, T>
where P: DispatchClientMessage<IgnoreEvents, T>, T: HasExecutor + 'static,

Spawns a dispatcher for the given client end on the default executor for the transport.

The spawned dispatcher will ignore all incoming events. Returns the client.

Trait Implementations§

Source§

impl<P1, P2, T> CompatFrom<ClientEnd<P1>> for ClientEnd<P2, T>
where T: CompatFrom<Channel>, P2: CompatFrom<P1>,

Source§

fn compat_from(value: ClientEnd<P1>) -> Self

Converts value into a value of this type.
Source§

impl<P1, P2, T> CompatFrom<ClientEnd<P1, T>> for ClientEnd<P2>
where Channel: CompatFrom<T>, P2: CompatFrom<P1>,

Source§

fn compat_from(value: ClientEnd<P1, T>) -> Self

Converts value into a value of this type.
Source§

impl<P: Debug, T: Debug> Debug for ClientEnd<P, T>

Source§

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

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

impl<D, P, T> Decode<D> for ClientEnd<P, T>
where D: ?Sized, P: 'static, T: Decode<D> + Constrained<Constraint = ()>,

Source§

fn decode( slot: Slot<'_, Self>, decoder: &mut D, constraint: <Self as Constrained>::Constraint, ) -> Result<(), DecodeError>

Decodes a value into a slot using a decoder. Read more
Source§

impl<'a, W, E, P, T> Encode<ClientEnd<P, W>, E> for &'a ClientEnd<P, T>
where E: ?Sized, P: 'static, &'a T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<ClientEnd<P, W>>, constraint: (), ) -> Result<(), EncodeError>

Encodes this value into an encoder and output.
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _

Whether the conversion from Self to W is equivalent to copying the raw bytes of Self. Read more
Source§

impl<W, E, P, T> Encode<ClientEnd<P, W>, E> for ClientEnd<P, T>
where E: ?Sized, P: 'static, T: Encode<W, E>, W: Constrained<Constraint = ()> + Wire,

Source§

fn encode( self, encoder: &mut E, out: &mut MaybeUninit<ClientEnd<P, W>>, constraint: (), ) -> Result<(), EncodeError>

Encodes this value into an encoder and output.
Source§

const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _

Whether the conversion from Self to W is equivalent to copying the raw bytes of Self. Read more
Source§

impl<'a, W, E, P, T> EncodeOption<ClientEnd<P, W>, E> for &'a ClientEnd<P, T>
where E: ?Sized, P: 'static, &'a T: EncodeOption<W, E>, W: Constrained<Constraint = ()>,

Source§

fn encode_option( this: Option<Self>, encoder: &mut E, out: &mut MaybeUninit<ClientEnd<P, W>>, constraint: (), ) -> Result<(), EncodeError>

Encodes this optional value into an encoder and output.
Source§

impl<W, E, P, T> EncodeOption<ClientEnd<P, W>, E> for ClientEnd<P, T>
where E: ?Sized, P: 'static, T: EncodeOption<W, E>, W: Constrained<Constraint = ()>,

Source§

fn encode_option( this: Option<Self>, encoder: &mut E, out: &mut MaybeUninit<ClientEnd<P, W>>, constraint: (), ) -> Result<(), EncodeError>

Encodes this optional value into an encoder and output.
Source§

impl<P, T, U> FromWire<ClientEnd<P, U>> for ClientEnd<P, T>
where T: FromWire<U>,

Source§

fn from_wire(wire: ClientEnd<P, U>) -> Self

Converts the given wire to this type.
Source§

const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _

Whether the conversion from W to Self is equivalent to copying the raw bytes of W. Read more
Source§

impl<P, T, U> FromWireOption<ClientEnd<P, U>> for ClientEnd<P, T>
where P: 'static, T: FromWireOption<U>, U: Wire,

Source§

fn from_wire_option(wire: ClientEnd<P, U>) -> Option<Self>

Converts the given wire to an option of this type.
Source§

impl<P, T, U> FromWireOptionRef<ClientEnd<P, U>> for ClientEnd<P, T>
where P: 'static, T: FromWireOptionRef<U>, U: Wire,

Source§

fn from_wire_option_ref(wire: &ClientEnd<P, U>) -> Option<Self>

Converts the given wire reference to an option of this type.
Source§

impl<P, T, U> FromWireRef<ClientEnd<P, U>> for ClientEnd<P, T>
where T: FromWireRef<U>,

Source§

fn from_wire_ref(wire: &ClientEnd<P, U>) -> Self

Converts the given wire reference to this type.
Source§

impl<P, T: IntoNatural> IntoNatural for ClientEnd<P, T>

Source§

type Natural = ClientEnd<P, <T as IntoNatural>::Natural>

A good default type for this wire type to convert into.
Source§

fn into_natural(self) -> Self::Natural

Converts this type into its natural equivalent.
Source§

impl<P: PartialEq, T: PartialEq> PartialEq for ClientEnd<P, T>

Source§

fn eq(&self, other: &ClientEnd<P, T>) -> 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<P: 'static, T: Wire> Wire for ClientEnd<P, T>

Source§

type Owned<'de> = ClientEnd<P, <T as Wire>::Owned<'de>>

The owned wire type, restricted to the 'de lifetime.
Source§

fn zero_padding(out: &mut MaybeUninit<Self>)

Writes zeroes to the padding for this type, if any.
Source§

impl<P, T: Send> Send for ClientEnd<P, T>

Source§

impl<P, T> StructuralPartialEq for ClientEnd<P, T>

Source§

impl<P, T: Sync> Sync for ClientEnd<P, T>

Source§

impl<P, T: Constrained<Constraint = ()>> Unconstrained for ClientEnd<P, T>

Auto Trait Implementations§

§

impl<P, T> Freeze for ClientEnd<P, T>
where T: Freeze,

§

impl<P, T> RefUnwindSafe for ClientEnd<P, T>

§

impl<P, T> Unpin for ClientEnd<P, T>
where T: Unpin, P: Unpin,

§

impl<P, T> UnwindSafe for ClientEnd<P, T>
where T: UnwindSafe, P: UnwindSafe,

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> Constrained for T
where T: Unconstrained,

Source§

type Constraint = ()

Type of constraint information for this type.
Source§

fn validate(_: Slot<'_, T>, _: ()) -> Result<(), ValidationError>

Validate a value of this type against a constraint. Can be called when pointers/envelopes are just presence markers.
Source§

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

Source§

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, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

Source§

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, W> FromWireOption<WireBox<'_, W>> for T
where T: FromWire<W>,

Source§

fn from_wire_option(wire: WireBox<'_, W>) -> Option<T>

Converts the given wire to an option of this type.
Source§

impl<T, W> FromWireOptionRef<WireBox<'_, W>> for T
where T: FromWireRef<W>,

Source§

fn from_wire_option_ref(wire: &WireBox<'_, W>) -> Option<T>

Converts the given wire reference to an option of this type.
Source§

impl<T> InstanceFromServiceTransport<T> for T

Source§

fn from_service_transport(handle: T) -> T

Converts the given service transport handle of type T to Self
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.
Source§

impl<E> RunsTransport<Mpsc> for E

Source§

impl<E> RunsTransport<Mpsc> for E
where E: RunsTransport<Mpsc>,