-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doced example acl_dryrun command #75
doced example acl_dryrun command #75
Conversation
@mcatanzariti, I would like to clarify with you. What comments do you think would best demonstrate the work of the methods? My suggestions.
The first option is short, simple, allows you to easily change this documentation in case of adding a new runtime or possibly a synchronous interface (which is very useful when there is no need for asynchrony or when a thread pool is also suitable). The second option requires a lot of hidden code, but the tests are passed. But we already have tests covering the code base in Which would be preferable for you? Maybe you have your own option? I would be happy to add 1-2 lines with the /// # Example
/// ```ignore
/// let result: String = client
/// .acl_dryrun("VIRGINIA", "GET", AclDryRunOptions::default().arg("foo"))
/// .await?;
/// assert_eq!(
/// "User VIRGINIA has no permissions to run the 'get' command",
/// result
/// );
///```
///
|
On the other hand, rust adheres to the rule of strict compliance of the example with its operability. As a Python developer, this approach is new to me. So, what's best for this project? |
Interesting discussion, it was also new to me when I started writing Rust code, 2 years ago. On one hand, I understand the point that having more boilerplate lines than the 2 actual lines that demonstrate the API for the sake of having a test that not only compiles but also does not fail can be really frustrating and it's probably why I don't have so many examples in the documentation. On the other hand, Rust is the first language that offers me the guaranty that examples exposed in the documentation are not obsolete whenever the API or its implementation evolves. Maybe it's ok to have ignorable examples to illustrate each Redis command as you are proposing it and at the same time having testable examples for the modules' introduction, as I have already implemented them. Cheers, Michaël |
great! I used hidden symbols that test the code and at the same time leave only the necessary information for the user. Thanks for your comment |
Sorry, documentation test don't pass |
@mcatanzariti, Hi! Thanks for the review. It looks like I made a mistake in the tests, in the comments. Let me fix this |
6f3008f
to
1bc23be
Compare
The lsp server(rust-analyzer) will perfectly show an example of this command.