Contributor
This example panic when encounting the scan key results.
Spotting two bugs:
- the
raw::Client::scandoes not understand inclusive bounds correctly - the
raw::Client::delete_rangedoes not delete anything
Please remove the unused import:
--> examples/raw.rs:18:61
|
18 | use tikv_client::{raw::Client, Config, Key, KvPair, Result, Value};
| ^^^^^
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although they do look verbose. I guess the type annotations were there on purpose to make the example clear, isn't it @Hoverbear ?
Contributor
@sunxiaoguang that was the intention. Do you think it's better to remove them?
I don't really want to encourage people to use &'static str in things other than examples and little toy codes. Maybe it's better to use Vec<u8>s?
Member
@sunxiaoguang that was the intention. Do you think it's better to remove them?
I personally had difficulties when I just started learning Rust and had to turn to IDE to know the real types. So as a vim user, I think type annotation is more friendly for new learners of Rust.
Member
Maybe two separate examples for Rust new learners and TiKV new users? They probably like different styles.
Contributor Author
I rebased on master to retrieve the modifications about the raw get method returning an optional value and modified the example in consequence.
I also kept the type annotations to make it clear for new users, I think it is not necessary to create multiple examples. Advanced Rust users will understand the beginner example.
I added some comments and forced KEY and VALUE to be Key and Value to keep a consistent display when compared to the keys/values retrieved from the server when running the test.
Contributor
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contributor
I do notice that this is failing on rustfmt, though there are existing rustfmt failures. Since the CI is reportedly busted, and it's a pre-existing problem, and this has been waiting for too long, I'm going to force merge. Someone else will clean up the testing mess later.