Skip to main content

payload_kind

Function payload_kind 

Source
pub fn payload_kind(payload: Option<&CanonicalPayload>) -> &'static str
Expand description

Returns a string representation of the payload kind for logging.

This is a utility function for structured logging to categorize payloads without exposing actual content.

§Arguments

  • payload - Optional reference to canonical payload

§Returns

String describing the payload type: "text", "binary", or "none"

§Examples

use ingest::{payload_kind, CanonicalPayload};

let text = Some(CanonicalPayload::Text("hello".to_string()));
assert_eq!(payload_kind(text.as_ref()), "text");

let binary = Some(CanonicalPayload::Binary(vec![1, 2, 3]));
assert_eq!(payload_kind(binary.as_ref()), "binary");

assert_eq!(payload_kind(None), "none");