Boxing and Unboxing Results

I recently wrote this nasty piece of code:

What annoys me about this is that it feels unhygienic. Like in my last article, I’m doing way too much work. The clunkiness of having to match everything against a Result, only to then re-wrap each output in the correct variant, completely obscures the beauty of that match expression. I mean, seriously, look at it! Not blowing my own horn — I didn’t have to be all that smart to write it — I’m simply pointing out the expressiveness of Rust pattern matching. Even as I was writing this, I was…


Temporary Value Dropped While Borrowed

I am at a point in my Rust development where I have started to identify some… slightly sub-optimal approaches I may have taken in my naïveté. It occurred to me that other people at a similar stage of their Rust journey might benefit from seeing my n00b mistakes and how I fixed them once I had a little bit more insight.

Today’s exercise is this function:

This uses the git2 crate to create a child branch off an existing branch. It takes that parent branch, gets a git reference from it (a type of object in the git internals…

Tim Keating

Tim Keating is a Principal Engineer at Zynga. He has been developing software, and talking about developing software, for a long, long time.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store