Setting up the rust project

Technically I did this before I wrote the thrift file, but I wanted to write that post first. I won’t cover every stage of how to start a project, in my case I’m simplifying and just building a binary but in a normal project there’d be some mix of libraries and then a final server binary. I’m using the links from this post as a starting point for figuring out how to make this work. Since I’m on windows this is all, of course, a decent bit harder.

I ended up having to install MSVS17 and then building the thrift compiler from source because the binaries available from Apache when I wrote this did not have the rust target built in. This README is basically usable for how to get the codegen to go. At this point you will have a generated file with Rust implementations of all of the stuff you defined in your IDL.

After setting up your Cargo.toml as instructed and doing your imports in main.rs you now have a slower than usual to compile hello world app. Even for the server I am going to be using clap because I truly loathe writing argument handling code and clap is actually not bad to use in my very limited exposure. When I write my client I’ll have a lot more to say, I’m sure. This is where I should also note I’m being a bad person and starting off wrong. I should be putting the kv thrift stuff into its own library and bring it into kv_server as a crate. I will never claim to be especially good at this stuff, and I have decided to write up when I get to the point of writing a proper external client and not wanting to keep synchronizing a thrift file.