pub struct HealthAlertReporter { /* private fields */ }Expand description
Lets a driver proactively report faults to the driver framework as OnHealthAlert events.
Obtained from crate::DriverContext::health_alert_reporter while the driver is starting.
Unlike the rest of the driver’s lifecycle, alerts are driver-initiated and may come from any
task or thread, so the reporter is cheap to clone and drivers typically keep one in their own
state.
Implementations§
Source§impl HealthAlertReporter
impl HealthAlertReporter
Sourcepub fn new_for_testing() -> (Self, Receiver<HealthAlert>)
pub fn new_for_testing() -> (Self, Receiver<HealthAlert>)
Creates a reporter and alert receiver pair for unit tests that construct a driver directly without a lifecycle server.
Sourcepub fn report_health_alert(&self, alert: HealthAlert)
pub fn report_health_alert(&self, alert: HealthAlert)
Emits an OnHealthAlert event over the Driver channel to the driver framework.
This never blocks: on a running driver the event is written synchronously to the underlying
fdf_fidl::DriverChannel via fidl_next::SendFuture::send_immediately; alerts
reported after the driver has been asked to stop are dropped.
Alerts are not mirrored into Inspect automatically; a driver that records its health there
can pass SelfFault alerts to HealthCheckInspect::record_alert as well.
Trait Implementations§
Source§impl Clone for HealthAlertReporter
impl Clone for HealthAlertReporter
Source§impl Default for HealthAlertReporter
impl Default for HealthAlertReporter
Source§fn default() -> Self
fn default() -> Self
Returns a disconnected reporter: every alert reported through it is dropped (logged at
debug). Intended only for tests or placeholders; use
crate::DriverContext::health_alert_reporter in a running driver or
HealthAlertReporter::new_for_testing to observe alerts in a test.
Auto Trait Implementations§
impl !RefUnwindSafe for HealthAlertReporter
impl !UnwindSafe for HealthAlertReporter
impl Freeze for HealthAlertReporter
impl Send for HealthAlertReporter
impl Sync for HealthAlertReporter
impl Unpin for HealthAlertReporter
impl UnsafeUnpin for HealthAlertReporter
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> 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,
§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