pub struct Router<T: CapabilityBound> { /* private fields */ }Expand description
A Router is a capability that lets the holder obtain other capabilities
asynchronously. Router is the object capability representation of
Routable.
During routing, a request usually traverses through the component topology, passing through several routers, ending up at some router that will fulfill the request instead of forwarding it upstream.
Implementations§
Source§impl<T: CapabilityBound> Router<T>
impl<T: CapabilityBound> Router<T>
Sourcepub fn new_error(error: impl Into<RouterError>) -> Arc<Self> ⓘ
pub fn new_error(error: impl Into<RouterError>) -> Arc<Self> ⓘ
Creates a router that will always fail a request with the provided error.
Sourcepub fn new_debug(source: CapabilitySource) -> Arc<Self> ⓘ
pub fn new_debug(source: CapabilitySource) -> Arc<Self> ⓘ
Creates a router that will always return the given debug info.
Sourcepub async fn route(
&self,
request: RouteRequest,
target: Arc<WeakInstanceToken>,
) -> Result<Option<Arc<T>>, RouterError>
pub async fn route( &self, request: RouteRequest, target: Arc<WeakInstanceToken>, ) -> Result<Option<Arc<T>>, RouterError>
Obtain a capability from this router, following the description in request.
Sourcepub async fn route_debug(
&self,
request: RouteRequest,
target: Arc<WeakInstanceToken>,
) -> Result<CapabilitySource, RouterError>
pub async fn route_debug( &self, request: RouteRequest, target: Arc<WeakInstanceToken>, ) -> Result<CapabilitySource, RouterError>
Obtain a CapabilitySource from this router, following the description in request.
Source§impl<T: CapabilityBound> Router<T>
impl<T: CapabilityBound> Router<T>
Source§impl Router<Connector>
impl Router<Connector>
Sourcepub fn serve_and_register(
self: Arc<Self>,
stream: ConnectorRouterRequestStream,
koid: Koid,
token: Arc<WeakInstanceToken>,
)
pub fn serve_and_register( self: Arc<Self>, stream: ConnectorRouterRequestStream, koid: Koid, token: Arc<WeakInstanceToken>, )
Serves the fuchsia.sandbox.Router protocol and moves ourself into the registry.
Source§impl Router<Data>
impl Router<Data>
Sourcepub fn serve_and_register(
self: Arc<Self>,
stream: DataRouterRequestStream,
koid: Koid,
token: Arc<WeakInstanceToken>,
)
pub fn serve_and_register( self: Arc<Self>, stream: DataRouterRequestStream, koid: Koid, token: Arc<WeakInstanceToken>, )
Serves the fuchsia.sandbox.Router protocol and moves ourself into the registry.
Source§impl Router<Dictionary>
impl Router<Dictionary>
Sourcepub fn serve_and_register(
self: Arc<Self>,
stream: DictionaryRouterRequestStream,
koid: Koid,
token: Arc<WeakInstanceToken>,
)
pub fn serve_and_register( self: Arc<Self>, stream: DictionaryRouterRequestStream, koid: Koid, token: Arc<WeakInstanceToken>, )
Serves the fuchsia.sandbox.Router protocol and moves ourself into the registry.
Source§impl Router<DirConnector>
impl Router<DirConnector>
Sourcepub fn serve_and_register(
self: Arc<Self>,
stream: DirConnectorRouterRequestStream,
koid: Koid,
token: Arc<WeakInstanceToken>,
)
pub fn serve_and_register( self: Arc<Self>, stream: DirConnectorRouterRequestStream, koid: Koid, token: Arc<WeakInstanceToken>, )
Serves the fuchsia.sandbox.Router protocol and moves ourself into the registry.
Trait Implementations§
Source§impl CapabilityBound for Router<Connector>
impl CapabilityBound for Router<Connector>
fn debug_typename() -> &'static str
Source§fn try_into_directory_entry(
self: Arc<Self>,
scope: ExecutionScope,
token: Arc<WeakInstanceToken>,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self: Arc<Self>, scope: ExecutionScope, token: Arc<WeakInstanceToken>, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
Source§impl CapabilityBound for Router<Data>
impl CapabilityBound for Router<Data>
fn debug_typename() -> &'static str
Source§fn try_into_directory_entry(
self: Arc<Self>,
scope: ExecutionScope,
token: Arc<WeakInstanceToken>,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self: Arc<Self>, scope: ExecutionScope, token: Arc<WeakInstanceToken>, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
Source§impl CapabilityBound for Router<Dictionary>
impl CapabilityBound for Router<Dictionary>
fn debug_typename() -> &'static str
Source§fn try_into_directory_entry(
self: Arc<Self>,
scope: ExecutionScope,
token: Arc<WeakInstanceToken>,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self: Arc<Self>, scope: ExecutionScope, token: Arc<WeakInstanceToken>, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
Source§impl CapabilityBound for Router<DirConnector>
impl CapabilityBound for Router<DirConnector>
fn debug_typename() -> &'static str
Source§fn try_into_directory_entry(
self: Arc<Self>,
scope: ExecutionScope,
token: Arc<WeakInstanceToken>,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self: Arc<Self>, scope: ExecutionScope, token: Arc<WeakInstanceToken>, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
Source§impl<T: CapabilityBound> Debug for Router<T>
impl<T: CapabilityBound> Debug for Router<T>
Source§impl<T: CapabilityBound> Routable<T> for Router<T>
impl<T: CapabilityBound> Routable<T> for Router<T>
fn route<'life0, 'async_trait>(
&'life0 self,
request: RouteRequest,
target: Arc<WeakInstanceToken>,
) -> Pin<Box<dyn Future<Output = Result<Option<Arc<T>>, RouterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn route_debug<'life0, 'async_trait>(
&'life0 self,
request: RouteRequest,
target: Arc<WeakInstanceToken>,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySource, RouterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn route_debug<'life0, 'async_trait>(
&'life0 self,
request: RouteRequest,
target: Arc<WeakInstanceToken>,
) -> Pin<Box<dyn Future<Output = Result<CapabilitySource, RouterError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
route, but returns a
fidl_fuchsia_internal::CapabilitySource persisted into bytes.Auto Trait Implementations§
impl<T> Freeze for Router<T>
impl<T> !RefUnwindSafe for Router<T>
impl<T> Send for Router<T>
impl<T> Sync for Router<T>
impl<T> Unpin for Router<T>
impl<T> UnsafeUnpin for Router<T>
impl<T> !UnwindSafe for Router<T>
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
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,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
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>
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>
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