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.
Router
differs from Router
in that it is parameterized on the capability
type T
. Instead of a Capability
, Router
returns a RouterResponse
.
Router
will supersede Router
.
Implementations§
Source§impl<T: CapabilityBound> Router<T>
impl<T: CapabilityBound> Router<T>
Sourcepub fn new_error(error: impl Into<RouterError>) -> Self
pub fn new_error(error: impl Into<RouterError>) -> Self
Creates a router that will always fail a request with the provided error.
Sourcepub fn new_debug(data: impl Into<Data>) -> Self
pub fn new_debug(data: impl Into<Data>) -> Self
Creates a router that will always return the given debug info.
Sourcepub async fn route(
&self,
request: Option<Request>,
debug: bool,
) -> Result<RouterResponse<T>, RouterError>
pub async fn route( &self, request: Option<Request>, debug: bool, ) -> Result<RouterResponse<T>, RouterError>
Obtain a capability from this router, following the description in request
.
Source§impl<T: Clone + CapabilityBound> Router<T>
impl<T: Clone + CapabilityBound> Router<T>
Source§impl Router<Connector>
impl Router<Connector>
Sourcepub fn serve_and_register(
self,
stream: ConnectorRouterRequestStream,
koid: Koid,
)
pub fn serve_and_register( self, stream: ConnectorRouterRequestStream, koid: Koid, )
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, stream: DataRouterRequestStream, koid: Koid)
pub fn serve_and_register(self, stream: DataRouterRequestStream, koid: Koid)
Serves the fuchsia.sandbox.Router
protocol and moves ourself into the registry.
Source§impl Router<Dict>
impl Router<Dict>
Sourcepub fn serve_and_register(
self,
stream: DictionaryRouterRequestStream,
koid: Koid,
)
pub fn serve_and_register( self, stream: DictionaryRouterRequestStream, koid: Koid, )
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,
stream: DirConnectorRouterRequestStream,
koid: Koid,
)
pub fn serve_and_register( self, stream: DirConnectorRouterRequestStream, koid: Koid, )
Serves the fuchsia.sandbox.Router
protocol and moves ourself into the registry.
Source§impl Router<DirEntry>
impl Router<DirEntry>
Sourcepub fn serve_and_register(self, stream: DirEntryRouterRequestStream, koid: Koid)
pub fn serve_and_register(self, stream: DirEntryRouterRequestStream, koid: Koid)
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§impl CapabilityBound for Router<Data>
impl CapabilityBound for Router<Data>
fn debug_typename() -> &'static str
Source§impl CapabilityBound for Router<Dict>
impl CapabilityBound for Router<Dict>
fn debug_typename() -> &'static str
Source§impl CapabilityBound for Router<DirConnector>
impl CapabilityBound for Router<DirConnector>
fn debug_typename() -> &'static str
Source§impl CapabilityBound for Router<DirEntry>
impl CapabilityBound for Router<DirEntry>
fn debug_typename() -> &'static str
Source§impl<T: CapabilityBound> Debug for Router<T>
impl<T: CapabilityBound> Debug for Router<T>
Source§impl From<Router<DirConnector>> for Capability
impl From<Router<DirConnector>> for Capability
Source§fn from(f: Router<DirConnector>) -> Self
fn from(f: Router<DirConnector>) -> Self
Source§impl From<Router<DirConnector>> for Capability
impl From<Router<DirConnector>> for Capability
Source§fn from(router: Router<DirConnector>) -> Self
fn from(router: Router<DirConnector>) -> Self
Source§impl FromEnum<Capability> for Router<Connector>
impl FromEnum<Capability> for Router<Connector>
fn from_enum(e: &Capability) -> Option<&Self>
Source§impl FromEnum<Capability> for Router<Data>
impl FromEnum<Capability> for Router<Data>
fn from_enum(e: &Capability) -> Option<&Self>
Source§impl FromEnum<Capability> for Router<Dict>
impl FromEnum<Capability> for Router<Dict>
fn from_enum(e: &Capability) -> Option<&Self>
Source§impl FromEnum<Capability> for Router<DirConnector>
impl FromEnum<Capability> for Router<DirConnector>
fn from_enum(e: &Capability) -> Option<&Self>
Source§impl FromEnum<Capability> for Router<DirEntry>
impl FromEnum<Capability> for Router<DirEntry>
fn from_enum(e: &Capability) -> Option<&Self>
Source§impl RemotableCapability for Router<Connector>
impl RemotableCapability for Router<Connector>
Source§fn try_into_directory_entry(
self,
scope: ExecutionScope,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self, scope: ExecutionScope, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
self
to a DirectoryEntry which can be served in a
VFS. Read moreSource§impl RemotableCapability for Router<Data>
impl RemotableCapability for Router<Data>
Source§fn try_into_directory_entry(
self,
scope: ExecutionScope,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self, scope: ExecutionScope, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
self
to a DirectoryEntry which can be served in a
VFS. Read moreSource§impl RemotableCapability for Router<Dict>
impl RemotableCapability for Router<Dict>
Source§fn try_into_directory_entry(
self,
scope: ExecutionScope,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self, scope: ExecutionScope, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
self
to a DirectoryEntry which can be served in a
VFS. Read moreSource§impl RemotableCapability for Router<DirConnector>
impl RemotableCapability for Router<DirConnector>
Source§fn try_into_directory_entry(
self,
scope: ExecutionScope,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self, scope: ExecutionScope, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
self
to a DirectoryEntry which can be served in a
VFS. Read moreSource§impl RemotableCapability for Router<DirEntry>
impl RemotableCapability for Router<DirEntry>
Source§fn try_into_directory_entry(
self,
scope: ExecutionScope,
) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
fn try_into_directory_entry( self, scope: ExecutionScope, ) -> Result<Arc<dyn DirectoryEntry>, ConversionError>
self
to a DirectoryEntry which can be served in a
VFS. Read moreSource§impl<T: CapabilityBound> Routable<T> for Router<T>
impl<T: CapabilityBound> Routable<T> for Router<T>
Source§impl TryFrom<Capability> for Router<DirConnector>
impl TryFrom<Capability> for Router<DirConnector>
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> !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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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