thisctx 0.4.0

Easily create error with contexts
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use thisctx::WithContext;

#[derive(WithContext)]
#[thisctx(doc = "I'm on Line#2\n\n", derive(Clone))]
pub enum Error {
    #[thisctx(doc = "I'm on Line#1\n\n", derive(Copy))]
    ExtendAttributes(String),
    #[thisctx(doc = "I'm also on Line#1\n\n")]
    FieldAttributes(#[thisctx(doc = "I'm a field")] String),
}

fn requires_copied<T: Copy>(_: T) {}

#[test]
fn attr_attr() {
    requires_copied(ExtendAttributes("What's going on?"));
}