Skip to content

derive Render #6

Description

@killercup

Offer a simple derive that used some default style and allows to do

#[derive(Serialize, RenderOutput)]
struct Foo { name: String, code: i32}

out.print(Foo { name: "hallo".into(), code: 42 })?;

The goal is to let people write even less code. This is an experiment, though, and only in addition to "manually" implemementing using the macros.

  1. Create proc macro crate output_derive
  2. Add a simple derive macro RenderOutput
  • only works for structs for now
  • generates the most trivial impl Render for $type
    • human output: just list all the fields separated by newlines
    • json output: same as render_json!();
  1. Add attributes to fields to add some formatting/converting.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions