pub enum AttributionMode {
Derived,
Explicit,
}Expand description
The value of the x-tracevault-project-attribution header: the two
spellings the server accepts, and no others.
A type rather than a &str because the wire contract is closed on the
server side and fails LOUDLY: explicit and derived are the only
accepted values, and anything else — a typo, a future mode this build
does not know about, a hand-passed literal — is a 400, not a silently
ignored header. Every value is produced today by
commands::stream::attribution_mode, so the invariant already holds, but
it holds only by convention: one new call site passing "Explicit" or
"forced" would turn a working hook into a hard client error. An enum
moves that from “documented” to “unrepresentable”, the same move that
makes ClientErrorKind and ForceStatus types.
The CLI’s own tolerance runs the other way, deliberately: an unrecognised
TRACEVAULT_PROJECT_ATTRIBUTION reads as Derived rather than being
forwarded (see commands::stream::attribution_mode), so a typo’d env var
never reaches the server to be rejected. This enum is what keeps that
function the only place a mode is decided.
Variants§
Derived
Visdom checks repo→project membership itself. The default, and what an absent header also means.
Explicit
The caller owns attribution and the server skips the membership
check. A trust claim, gated server-side (Operator + a Control Plane
identity).
Implementations§
Source§impl AttributionMode
impl AttributionMode
Sourcepub fn as_header_value(self) -> &'static str
pub fn as_header_value(self) -> &'static str
The wire spelling. THE one place a mode becomes a string — the header
write in ApiClient::stream_event_for_project and the fmt::Display
impl below both go through this match, so no surface can invent a
third spelling or disagree with the wire.
Trait Implementations§
Source§impl Clone for AttributionMode
impl Clone for AttributionMode
impl Copy for AttributionMode
Source§impl Debug for AttributionMode
impl Debug for AttributionMode
Source§impl Display for AttributionMode
impl Display for AttributionMode
impl Eq for AttributionMode
Source§impl PartialEq for AttributionMode
impl PartialEq for AttributionMode
impl StructuralPartialEq for AttributionMode
Auto Trait Implementations§
impl Forget for AttributionMode
impl Freeze for AttributionMode
impl Move for AttributionMode
impl RefUnwindSafe for AttributionMode
impl Send for AttributionMode
impl Sync for AttributionMode
impl Unpin for AttributionMode
impl UnsafeUnpin for AttributionMode
impl UnwindSafe for AttributionMode
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
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.