pub struct Connection<N: Node> { /* private fields */ }
Expand description
Represents a FIDL (limited) node connection.
Implementations§
Source§impl<N: Node> Connection<N>
impl<N: Node> Connection<N>
Sourcepub async fn create(
scope: ExecutionScope,
node: Arc<N>,
options: impl ToNodeOptions,
object_request: ObjectRequestRef<'_>,
) -> Result<(), Status>
pub async fn create( scope: ExecutionScope, node: Arc<N>, options: impl ToNodeOptions, object_request: ObjectRequestRef<'_>, ) -> Result<(), Status>
Creates a new connection to serve the node. The node will be served from a new async Task
,
not from the current Task
. Errors in constructing the connection are not guaranteed to be
returned, they may be sent directly to the client end of the connection. This method should
be called from within an ObjectRequest
handler to ensure that errors are sent to the
client end of the connection.
Sourcepub fn create_sync(
scope: ExecutionScope,
node: Arc<N>,
options: impl ToNodeOptions,
object_request: ObjectRequest,
)
pub fn create_sync( scope: ExecutionScope, node: Arc<N>, options: impl ToNodeOptions, object_request: ObjectRequest, )
Similar to create
but optimized for nodes whose implementation is synchronous and creating
the connection is being done from a non-async context.
Trait Implementations§
Source§impl<N: Node> ConnectionCreator<N> for Connection<N>
impl<N: Node> ConnectionCreator<N> for Connection<N>
Source§async fn create<'a>(
scope: ExecutionScope,
node: Arc<N>,
protocols: impl ProtocolsExt,
object_request: ObjectRequestRef<'a>,
) -> Result<(), Status>
async fn create<'a>( scope: ExecutionScope, node: Arc<N>, protocols: impl ProtocolsExt, object_request: ObjectRequestRef<'a>, ) -> Result<(), Status>
Creates a new connection to
node
and spawns a new Task
to run the connection.Source§impl<N: Node> Representation for Connection<N>
impl<N: Node> Representation for Connection<N>
Source§type Protocol = NodeMarker
type Protocol = NodeMarker
The protocol used for the connection.
Source§async fn get_representation(
&self,
requested_attributes: NodeAttributesQuery,
) -> Result<Representation, Status>
async fn get_representation( &self, requested_attributes: NodeAttributesQuery, ) -> Result<Representation, Status>
Returns io2’s Representation for the object.
Auto Trait Implementations§
impl<N> Freeze for Connection<N>
impl<N> !RefUnwindSafe for Connection<N>
impl<N> Send for Connection<N>
impl<N> Sync for Connection<N>
impl<N> Unpin for Connection<N>
impl<N> !UnwindSafe for Connection<N>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more