#[non_exhaustive]pub enum CanonicalPayload {
Text(String),
Binary(Vec<u8>),
}Expand description
Normalized payload ready for downstream stages.
CanonicalPayload represents the final, processed form of ingest payload.
Text payloads have whitespace normalized, while binary payloads pass through
unchanged.
§Variants
Text(String): Normalized UTF-8 text with collapsed whitespaceBinary(Vec<u8>): Binary payload preserved exactly
§Examples
use ingest::CanonicalPayload;
// Normalized text
let text = CanonicalPayload::Text("Hello world".to_string());
// Preserved binary
let binary = CanonicalPayload::Binary(vec![0x89, 0x50, 0x4E, 0x47]);Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
Normalized UTF-8 text payload.
Text has been through whitespace normalization (multiple spaces/tabs/newlines collapsed to single spaces, leading/trailing whitespace trimmed).
§Example
use ingest::CanonicalPayload;
// This represents text that was " Hello world " before normalization
let payload = CanonicalPayload::Text("Hello world".to_string());Binary(Vec<u8>)
Binary payload preserved for downstream perceptual/semantic stages.
Binary data (images, PDFs, audio, etc.) passes through ingest unchanged except for the non-empty validation.
§Example
use ingest::CanonicalPayload;
let payload = CanonicalPayload::Binary(vec![0x89, 0x50, 0x4E, 0x47]);Implementations§
Source§impl CanonicalPayload
impl CanonicalPayload
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the length of the payload in bytes.
§Example
use ingest::CanonicalPayload;
let text = CanonicalPayload::Text("Hello".to_string());
assert_eq!(text.len(), 5);
let binary = CanonicalPayload::Binary(vec![1, 2, 3, 4]);
assert_eq!(binary.len(), 4);Trait Implementations§
Source§impl Clone for CanonicalPayload
impl Clone for CanonicalPayload
Source§fn clone(&self) -> CanonicalPayload
fn clone(&self) -> CanonicalPayload
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CanonicalPayload
impl Debug for CanonicalPayload
Source§impl<'de> Deserialize<'de> for CanonicalPayload
impl<'de> Deserialize<'de> for CanonicalPayload
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 PartialEq for CanonicalPayload
impl PartialEq for CanonicalPayload
Source§impl Serialize for CanonicalPayload
impl Serialize for CanonicalPayload
impl Eq for CanonicalPayload
impl StructuralPartialEq for CanonicalPayload
Auto Trait Implementations§
impl Freeze for CanonicalPayload
impl RefUnwindSafe for CanonicalPayload
impl Send for CanonicalPayload
impl Sync for CanonicalPayload
impl Unpin for CanonicalPayload
impl UnwindSafe for CanonicalPayload
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