Skip to content

Instantly share code, notes, and snippets.

@valarauca
Created August 20, 2017 22:54
Show Gist options
  • Save valarauca/62dc627e06db1799a9c4ded7f2ea051a to your computer and use it in GitHub Desktop.
Save valarauca/62dc627e06db1799a9c4ded7f2ea051a to your computer and use it in GitHub Desktop.
what I was trying to do
pub fn thing(id_req: String) -> impl IntoFuture<Item=DATA> {
GLOBAL_NAME_CACHE
.has_name(id)
.or_else(|x| match x {
Rename(name) => Ok(name),
e => Err(e)
})
.and_then(|x| Tx::ro(&x))
.or_else(|e| match e {
NotFound(name) => Ok(RPC::new(name)),
e => Err(e)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment