pub struct DiagnosticHandle { /* private fields */ }Expand description
A handle for exposing diagnostics from a component.
Components assert a handle where artifact name is suitable, but not guaranteed, to be used a filename
§Example:
ⓘ
DataspaceRegistry::try_current()?
.assert(
DiagnosticHandle::new("my_artifact.json", move || {
serde_json::to_vec(&my_state).unwrap_or_default()
}),
"diag-my-component",
);Implementations§
Source§impl DiagnosticHandle
impl DiagnosticHandle
Sourcepub fn new(
artifact_name: impl Into<String>,
collect_fn: impl Fn() -> Vec<u8> + Send + Sync + 'static,
) -> Self
pub fn new( artifact_name: impl Into<String>, collect_fn: impl Fn() -> Vec<u8> + Send + Sync + 'static, ) -> Self
Creates a new handle with the given artifact name and collection closure.
collect_fn must run synchronously and reasonably fast to produce artifact bytes
as it can delay entire diagnostic response
Sourcepub fn artifact_name(&self) -> &str
pub fn artifact_name(&self) -> &str
Returns the artifact name.
Trait Implementations§
Source§impl Clone for DiagnosticHandle
impl Clone for DiagnosticHandle
Source§fn clone(&self) -> DiagnosticHandle
fn clone(&self) -> DiagnosticHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DiagnosticHandle
impl !UnwindSafe for DiagnosticHandle
impl Freeze for DiagnosticHandle
impl Send for DiagnosticHandle
impl Sync for DiagnosticHandle
impl Unpin for DiagnosticHandle
impl UnsafeUnpin for DiagnosticHandle
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
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> Track for T
impl<T> Track for T
§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Instruments this type by attaching the given resource group token, returning a
Tracked wrapper. Read more§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Instruments this type by attaching the current resource group, returning a
Tracked wrapper. Read more