Skip to main content

InternalPayload

Enum InternalPayload 

Source
pub enum InternalPayload<'a> {
    Truth(&'a str),
    Lie(&'a str),
}
Expand description

Zero-allocation internal payload for SOC logging.

Returned by InternalContext::payload(). This type borrows from the underlying context and allows loggers to format output without heap allocation.

§Variants

  • Truth(&str): Authentic diagnostic message
  • Lie(&str): Deceptive message (should be prefixed in logs)

§Performance

The borrowed lifetime ties this to the parent InternalContext, preventing accidental persistence of sensitive data beyond the logging operation.

§No Copy Policy

While this type only contains &str (which is Copy), we deliberately do not derive Copy to maintain consistency with the module’s no-duplication philosophy. Use Clone if you need to store the payload temporarily.

§Usage Pattern

match context.payload() {
    Some(InternalPayload::Truth(msg)) => soc_log!("DIAG: {}", msg),
    Some(InternalPayload::Lie(msg)) => soc_log!("LIE: {}", msg),
    None => {
        // Sensitive - requires explicit access
        let access = SocAccess::acquire();
        if let Some(sensitive) = context.expose_sensitive(&access) {
            secure_log_encrypted(sensitive);
        }
    }
}

Variants§

§

Truth(&'a str)

§

Lie(&'a str)

Implementations§

Source§

impl<'a> InternalPayload<'a>

Source

pub const fn as_str(&self) -> &'a str

Get the raw message content without classification prefix.

§Returns

Borrowed string slice from the parent context. Valid until the InternalContext is dropped.

§Note

This does NOT include [LIE] prefix. Use the Display implementation if you want formatted output with classification markers.

Source

pub const fn is_lie(&self) -> bool

Check if this payload represents deceptive content.

§Returns
  • true: This is a lie, should be marked in logs
  • false: This is authentic diagnostic data
§Use Case

For conditional log routing or metrics collection based on deception status.

Trait Implementations§

Source§

impl<'a> Clone for InternalPayload<'a>

Source§

fn clone(&self) -> InternalPayload<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for InternalPayload<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> Display for InternalPayload<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Format payload with classification prefix for logging.

§Output Format
  • Truth: Raw message (no prefix)
  • Lie: [LIE] {message}
§Rationale

The [LIE] prefix prevents SOC analysts from mistaking deceptive content for authentic diagnostic data when reviewing logs. This is critical when logs may be exported to systems that lack context classification.

Auto Trait Implementations§

§

impl<'a> Freeze for InternalPayload<'a>

§

impl<'a> RefUnwindSafe for InternalPayload<'a>

§

impl<'a> Send for InternalPayload<'a>

§

impl<'a> Sync for InternalPayload<'a>

§

impl<'a> Unpin for InternalPayload<'a>

§

impl<'a> UnwindSafe for InternalPayload<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.