You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#[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.
The text was updated successfully, but these errors were encountered:
for this to work the expr it is attached to would have to compile and run within the docify proc macro so it can expand to a string there -- remember we are ultimately in doc comment position, so you have to think of these as compile-time Display impls. Probably what this should be is an attribute attached to a function where the function returns a String, and that function would be expected to compile without issues when copy-pasted into an arbitrary proc macro, in other words it can't use dependencies.
The scenario is this.
In your test functions, you have:
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 useDebug
/Display
impl of the sameprocess
variable, which will nicely format it asls -ln
.I suppose this can be done with
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.The text was updated successfully, but these errors were encountered: