#[non_exhaustive]pub struct DriverContext {
pub root_dispatcher: AsyncDispatcher,
pub start_args: DriverStartArgs,
pub incoming: Incoming,
/* private fields */
}Expand description
The context arguments passed to the driver in its start arguments.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.root_dispatcher: AsyncDispatcherA reference to the root fdf::Dispatcher for this driver.
start_args: DriverStartArgsThe original DriverStartArgs passed in as start arguments, minus any parts that were
used to construct other elements of Self.
incoming: IncomingThe incoming namespace constructed from DriverStartArgs::incoming. Since producing this
consumes the incoming namespace from Self::start_args, that will always be None.
Implementations§
Source§impl DriverContext
impl DriverContext
Sourcepub fn health_alert_reporter(&self) -> HealthAlertReporter
pub fn health_alert_reporter(&self) -> HealthAlertReporter
Returns a reporter through which the driver can proactively emit
fuchsia.driver.framework/Driver.OnHealthAlert events after crate::Driver::start has
consumed this context. The reporter is cheap to clone and may be used from any thread.
Sourcepub fn report_health_alert(&self, alert: HealthAlert)
pub fn report_health_alert(&self, alert: HealthAlert)
Reports alert to the driver framework. Equivalent to
self.health_alert_reporter().report_health_alert(alert); see
HealthAlertReporter::report_health_alert.
Sourcepub fn take_node(&mut self) -> Result<Node, Status>
pub fn take_node(&mut self) -> Result<Node, Status>
Binds the node proxy client end from the start args into a [NodeProxy] that can be used
to add child nodes. Dropping this proxy will result in the node being removed and the
driver starting shutdown, so it should be bound and stored in your driver object in its
crate::Driver::start method.
After calling this, DriverStartArgs::node in Self::start_args will be None.
Returns [Status::INVALID_ARGS] if the node client end is not present in the start
arguments.
Sourcepub fn take_config<C: Config>(&mut self) -> Result<C, Status>
pub fn take_config<C: Config>(&mut self) -> Result<C, Status>
Returns the component config.
After calling this, DriverStartArgs::config in Self::start_args will be None.
Returns [Status::INVALID_ARGS] if the config is not present in the start arguments.
Sourcepub fn serve_outgoing<O: ServiceObjTrait>(
&mut self,
outgoing_fs: &mut ServiceFs<O>,
) -> Result<(), Status>
pub fn serve_outgoing<O: ServiceObjTrait>( &mut self, outgoing_fs: &mut ServiceFs<O>, ) -> Result<(), Status>
Serves the given [ServiceFs] on the node’s outgoing directory. This can only be called
once, and after this the DriverStartArgs::outgoing_dir member will be None.
Logs an error and returns [Status::INVALID_ARGS] if the outgoing directory server end is
not present in the start arguments, or [Status::INTERNAL] if serving the connection
failed.
Sourcepub fn publish_inspect(
&self,
inspector: &Inspector,
scope: ScopeHandle,
) -> Result<(), Status>
pub fn publish_inspect( &self, inspector: &Inspector, scope: ScopeHandle, ) -> Result<(), Status>
Spawns a server handling fuchsia.inspect.Tree requests and a handle
to the fuchsia.inspect.Tree is published using fuchsia.inspect.InspectSink.
Whenever the client wishes to stop publishing Inspect, the Controller may be dropped.
Sourcepub fn inspect_content_publisher(&self) -> Result<ContentPublisher, Status>
pub fn inspect_content_publisher(&self) -> Result<ContentPublisher, Status>
Returns an inspect content publisher that acts as a stream for requests for inspect data.
Sourcepub fn node_name(&self) -> Option<&str>
pub fn node_name(&self) -> Option<&str>
Returns the name of the node that the driver is bound to, if present in the start arguments.
Sourcepub fn take_node_token(&mut self) -> Option<Event>
pub fn take_node_token(&mut self) -> Option<Event>
Takes the node token from the start arguments, if the driver host provided one. The token identifies the driver’s node to other framework services, such as the power framework.
After calling this, DriverStartArgs::node_token in Self::start_args will be None.
Sourcepub fn take_power_element_token(&mut self) -> Option<Event>
pub fn take_power_element_token(&mut self) -> Option<Event>
Takes the power element dependency token from the start arguments. The driver host provides it when the driver’s manifest opts in to a framework-managed power element.
After calling this, the token of DriverStartArgs::power_element_args in
Self::start_args will be None.
Sourcepub fn node_properties(&self) -> impl Iterator<Item = ParentProperty<'_>> + '_
pub fn node_properties(&self) -> impl Iterator<Item = ParentProperty<'_>> + '_
Returns the properties of the driver’s parent node(s) from the start arguments, in the
order the driver host provided them. See ParentProperty::parent for how the properties
are grouped.
Auto Trait Implementations§
impl !RefUnwindSafe for DriverContext
impl !UnwindSafe for DriverContext
impl Freeze for DriverContext
impl Send for DriverContext
impl Sync for DriverContext
impl Unpin for DriverContext
impl UnsafeUnpin for DriverContext
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
Source§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to Self§impl<T> IntoAny for T
impl<T> IntoAny for T
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