use crateResult;
use crateSegment;
/// A streaming encoder for transcription segments.
///
/// Decouples *segment production* (Whisper/VAD/etc.) from *segment presentation*
/// (JSON, VTT, plain text, ...).
///
/// Lifecycle:
/// - Call `write_segment` zero or more times.
/// - Call `close` exactly once when done.
/// - Implementations should treat `close()` as idempotent (safe to call multiple times).
///
/// Streaming considerations:
/// - Implementations should write incrementally and avoid buffering the full output
/// whenever possible.
/// - `close()` is where output is finalized (e.g., write trailing brackets, flush writers).