Skip to content

allow converting an expr to its Display impl #26

@kianenigma

Description

@kianenigma

The scenario is this.

In your test functions, you have:

#[test]
fn test_ls() {
  let process = Command::new(ls).arg("ln");
  // we then test that ls works as expected
}

and we want to show the same example in our docs, but showing let process = Command::new(ls).arg("ln") is not great. Ideally, we want to use Debug/Display impl of the same process variable, which will nicely format it as ls -ln.

I suppose this can be done with

#[test]
fn test_ls() {
  #[docify::export_display]
  let process = Command::new(ls).arg("ln");
  // we then test that ls works as expected
}

This is a very limited use-case. We can easily limit it to only work in assignment expressions, drop the lhs, assert rhs is a Command etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions