Skip to content

Derive serde Serialize/Deserialize on Completeness #9

Description

@mrpollo

Completeness derives Clone, Debug, PartialEq, Eq but not serde::Serialize / Deserialize. Downstream tools that persist parse results (e.g. flight-review-rs writes a metadata.json) want to record how a log ended — complete, truncated, or malformed — but can't serialize the enum directly. They currently have to define a local mirror enum plus a From conversion just to get it into JSON, which duplicates the type and drifts if a variant is ever added.

Request

Derive (or feature-gate) serde::Serialize and Deserialize on Completeness so it can be persisted directly:

// src/stream_parser/model.rs:176
#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum Completeness {
    Complete,
    Truncated,
    MalformedRecord(String),
}

A sensible default wire form is snake_case externally-tagged, i.e. "complete" / "truncated" / { "malformed_record": "..." }#[serde(rename_all = "snake_case")] gets that.

Notes

  • If you'd rather not take an unconditional serde dependency, gate it behind a serde feature so consumers opt in.
  • This only needs to cover Completeness. UlogParseError / ParseErrorType don't need it for this use case (the malformed string is already carried inside MalformedRecord).

Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions