Crates.io | error-chain-for-dumb-ides |
lib.rs | error-chain-for-dumb-ides |
version | 0.1.0 |
source | src |
created_at | 2018-01-20 16:58:27.944003 |
updated_at | 2018-01-20 16:58:27.944003 |
description | Faux' apt package manager for Debian |
homepage | |
repository | https://github.com/FauxFaux/error-chain-for-dumb-ides |
max_upload_size | |
id | 47548 |
size | 4,305 |
This library contains a massive hack to make using certain IDEs cope less poorly
with error-chain
heavy code.
error-chain is the error handling library for Rust. If you're not using it, you're doing it wrong.
However, it makes heavy use of Rust's macro system, which is not well understood by some IDEs.
This library provides a set of stubs which makes the IDEs slightly less dumb, and hence your experience slightly less awful.
Without it, completion fails for code like:
let a = foo().chain_err(|| "foo failed :(")?;
a. // <-- here.
Afterwards, it succeeds!
Add this crate as a dependency. dev-dependencies
is fine:
[dev-dependencies.error-chain-for-dumb-ides]
git = "https://github.com/FauxFaux/error-chain-for-dumb-ides"
As crates.io packages' dependencies cannot be from git repositories, you can use the crates.io published version. I do not plan to maintain support for old versions, even in git HEAD. To do this, instead use this fragment:
[dev-dependencies.error-chain-for-dumb-ides]
version = "0"
Import the crate. You can do this behind a nonsense cfg
, as this is just
totally ignored by the IDE, and the code is run anyway:
#[cfg(intellij_type_hinting)]
extern crate error_chain_for_dumb_ides;
Inside your mod errors {}
, import the crate's contents:
#[cfg(intellij_type_hinting)]
pub use error_chain_for_dumb_ides::stubs::*;
That's it! Now, suddenly, completion starts to work.
Here's an example of doing this in a real project.
CC0
.
Think "public domain", no rights reserved. Given this library is trivial, and never part of your production codebase anyway, any license is practically irrelevant anyway.