pub struct ReportRequest<R> {
pub tx: Arc<str>,
pub report: R,
}Expand description
Wraps report parameters with transaction metadata.
This type adds tx (transaction ID) to any report parameters struct.
Uses #[serde(flatten)] to serialize as a flat structure.
§Example
use serde::{Deserialize, Serialize};
use myko::report::ReportRequest;
// Report params (what user defines):
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ServerStatsOutput {
pub client_count: usize,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ServerStats {}
// Create a request:
let request = ReportRequest::new(ServerStats {});
// Reuse tx for correlation when needed:
let _same_tx = ReportRequest::with_tx(ServerStats {}, request.tx.clone());
// Serializes to: { "tx": "...", ...params }Fields§
§tx: Arc<str>§report: RImplementations§
Trait Implementations§
Source§impl<R: Clone> Clone for ReportRequest<R>
impl<R: Clone> Clone for ReportRequest<R>
Source§fn clone(&self) -> ReportRequest<R>
fn clone(&self) -> ReportRequest<R>
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 moreSource§impl<R: Debug> Debug for ReportRequest<R>
impl<R: Debug> Debug for ReportRequest<R>
Source§impl<R: Default> Default for ReportRequest<R>
impl<R: Default> Default for ReportRequest<R>
Source§impl<'de, R> Deserialize<'de> for ReportRequest<R>where
R: Deserialize<'de>,
impl<'de, R> Deserialize<'de> for ReportRequest<R>where
R: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<R: Clone> From<&ReportRequest<R>> for ReportRequest<R>
Convert a reference to a ReportRequest into an owned ReportRequest by cloning.
impl<R: Clone> From<&ReportRequest<R>> for ReportRequest<R>
Convert a reference to a ReportRequest into an owned ReportRequest by cloning.
Source§impl<R: ReportParams> From<R> for ReportRequest<R>
Convert report params directly into a ReportRequest.
This only works for types that implement ReportParams (actual report param structs),
not for ReportRequest itself, which avoids ambiguity with From<&ReportRequest>.
impl<R: ReportParams> From<R> for ReportRequest<R>
Convert report params directly into a ReportRequest.
This only works for types that implement ReportParams (actual report param structs),
not for ReportRequest itself, which avoids ambiguity with From<&ReportRequest
Source§impl<R: ReportParams> Report for ReportRequest<R>
impl<R: ReportParams> Report for ReportRequest<R>
Source§fn watch(
&self,
client: &MykoClient,
) -> Cell<Option<<Self as ReportOutputType>::Output>, CellImmutable>
fn watch( &self, client: &MykoClient, ) -> Cell<Option<<Self as ReportOutputType>::Output>, CellImmutable>
Watch this report on a client connection
Source§impl<R: ReportIdStatic> ReportIdStatic for ReportRequest<R>
impl<R: ReportIdStatic> ReportIdStatic for ReportRequest<R>
fn report_id_static() -> &'static str
Source§impl<R: ReportOutputType> ReportOutputType for ReportRequest<R>
impl<R: ReportOutputType> ReportOutputType for ReportRequest<R>
type Output = <R as ReportOutputType>::Output
Source§impl<R> Serialize for ReportRequest<R>where
R: Serialize,
impl<R> Serialize for ReportRequest<R>where
R: Serialize,
Auto Trait Implementations§
impl<R> Freeze for ReportRequest<R>where
R: Freeze,
impl<R> RefUnwindSafe for ReportRequest<R>where
R: RefUnwindSafe,
impl<R> Send for ReportRequest<R>where
R: Send,
impl<R> Sync for ReportRequest<R>where
R: Sync,
impl<R> Unpin for ReportRequest<R>where
R: Unpin,
impl<R> UnsafeUnpin for ReportRequest<R>where
R: UnsafeUnpin,
impl<R> UnwindSafe for ReportRequest<R>where
R: UnwindSafe,
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<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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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