pub enum ReportPayloadShape {
NdJsonLines,
OpaqueBytes,
}Expand description
How the export worker should embed a TestReportSource’s bytes into
the shipped ExportEvent.payload. Lifted as a closed-set typed
projection from ReportFormat::payload_shape so the worker’s
dispatch is exhaustive on ReportPayloadShape, not on ReportFormat
with a silent _ arm. Adding a future ReportFormat variant forces
the author to pick its shape here (single edit site); adding a
future shape (e.g. compressed) forces every consumer to handle it.
The (shape, JSON-embed-field) pairing — NdJsonLines → "ndjson",
OpaqueBytes → "raw_b64" — binds at ONE typed projection
(Self::payload_field) rather than at the future worker’s
embed-site string literals; pre-lift the field names lived in this
enum’s per-variant docstring prose AND would have lived at the
worker’s payload.insert("ndjson", …) / payload.insert("raw_b64", …) call sites, where a rename of "raw_b64" → "raw" at one site
drifts silently from the docstring and the operator-facing shinryu
schema.
Sibling typed-projection lift over a closed enum (rather than
matches! / _ arm dispatch):
crate::lifetime::TeardownPolicy::should_teardown_on,
ExportTrigger::fires_on, crate::phase::ProcessPhase::as_str.
Sibling closed-set Self::ALL lift in lockstep with every other
ALL-keyed enum on the same ExportSpec axis (ReportFormat::ALL,
ExportTrigger::ALL) and across the crate
(crate::phase::ProcessPhase::ALL,
crate::signal::ProcessSignal::ALL,
crate::boundary::ConditionKind::ALL,
crate::lifetime::TeardownPolicy::ALL).
Variants§
NdJsonLines
Newline-delimited JSON — split on \n, parse each non-empty
line as JSON, embed under payload.<payload_field> (=
payload.ndjson) as an array. Field name is the typed
projection Self::payload_field so no embed-site literal
can drift from this docstring.
OpaqueBytes
Opaque bytes — base64-encode the artifact verbatim, embed
under payload.<payload_field> (= payload.raw_b64) as a
string. The default shape for anything Vector / shinryu
shouldn’t pre-parse. Field name is the typed projection
Self::payload_field.
Implementations§
Source§impl ReportPayloadShape
impl ReportPayloadShape
Sourcepub const ALL: [Self; 2]
pub const ALL: [Self; 2]
The closed set of payload shapes — single source of truth
that drives the Self::as_str / fmt::Display pair and
the Self::payload_field projection. Adding a third shape
(e.g. Compressed → "gzip") lands at one ALL entry + one
as_str arm + one payload_field arm + at least one new
ReportFormat::payload_shape mapping — exhaustively checked
by the compiler (the [Self; 2] array literal forces the
arity).
Sibling closed-set lifts on the same ExportSpec axis:
ReportFormat::ALL, ExportTrigger::ALL,
crate::lifetime::TeardownPolicy::ALL,
crate::boundary::ConditionKind::ALL,
crate::phase::ProcessPhase::ALL,
crate::signal::ProcessSignal::ALL,
crate::encapsulates::EncapsulationMode::ALL.
Sourcepub const fn as_str(self) -> &'static str
pub const fn as_str(self) -> &'static str
Canonical PascalCase identifier — used by fmt::Display (so
format!("{shape}") never reaches for {:?} Debug) and as
the operator-facing reason-string projection. No serde wire
shape today (the enum is worker-internal), but the identifier
matches the sibling-aligned as_str shape that every other
closed-set enum in this crate exposes
(ReportFormat::as_str, ExportTrigger::as_str,
crate::phase::ProcessPhase::as_str). Pinned by
report_payload_shape_as_str_unique_per_variant.
Sourcepub const fn payload_field(self) -> &'static str
pub const fn payload_field(self) -> &'static str
The JSON field name within ExportEvent.payload where the
worker embeds this shape’s encoded value — "ndjson" for the
newline-split array, "raw_b64" for the base64-encoded
opaque string. Pre-lift these names lived ONLY in the
per-variant docstring prose; once the export worker lands, a
rename at the embed site (payload.insert("ndjson", …) →
payload.insert("events", …)) silently drifts from the
docstring and from the operator-facing shinryu schema with no
compile or runtime signal. Post-lift the worker’s embed site
is payload.insert(shape.payload_field().into(), …) and a
rename lands at ONE arm here. The per-variant uniqueness
invariant (no two shapes alias to the same field name) is
pinned by report_payload_shape_payload_field_unique_per_ variant so the worker’s embed site cannot have two shapes
collide on the same destination key. Truth table pinned by
report_payload_shape_payload_field_truth_table so a future
rename lands here at one site, not in the worker.
Trait Implementations§
Source§impl Clone for ReportPayloadShape
impl Clone for ReportPayloadShape
Source§fn clone(&self) -> ReportPayloadShape
fn clone(&self) -> ReportPayloadShape
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReportPayloadShape
Source§impl Debug for ReportPayloadShape
impl Debug for ReportPayloadShape
Source§impl Display for ReportPayloadShape
impl Display for ReportPayloadShape
impl Eq for ReportPayloadShape
Source§impl Hash for ReportPayloadShape
impl Hash for ReportPayloadShape
Source§impl PartialEq for ReportPayloadShape
impl PartialEq for ReportPayloadShape
impl StructuralPartialEq for ReportPayloadShape
Auto Trait Implementations§
impl Freeze for ReportPayloadShape
impl RefUnwindSafe for ReportPayloadShape
impl Send for ReportPayloadShape
impl Sync for ReportPayloadShape
impl Unpin for ReportPayloadShape
impl UnsafeUnpin for ReportPayloadShape
impl UnwindSafe for ReportPayloadShape
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> 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> ⓘ
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 moreimpl<T> OptionalSend for T
impl<T> OptionalSync for T
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);