Skip to main content

render

Function render 

Source
pub fn render(
    envelope: &Envelope,
    format: OutputFormat,
    opts: &RenderOptions,
) -> Result<String, FaceError>
Expand description

Render an envelope as the chosen format.

§Errors

Returns FaceError only when the underlying serializer fails. All current formats are infallible in practice, but the signature is Result so future formats (or upstream serde_json errors) surface cleanly without an API break.

§Examples

use face_core::{render, Envelope, OutputFormat, RenderOptions};

let env = Envelope::default();
let out = render(&env, OutputFormat::Human, &RenderOptions::default()).unwrap();
// Empty envelope renders as just the header line.
assert!(out.starts_with("face: 0 items"));