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(attr(doc = "I'm on Line#2\n\n"), attr(derive(Clone)))]
pub enum Error {
    #[thisctx(attr(doc = "I'm on Line#1\n\n"), attr(derive(Copy)))]
    ExtendAttributes(String),
    #[thisctx(attr(doc = "I'm also on Line#1\n\n"))]
    FieldAttributes(#[thisctx(attr(doc = "I'm a field"))] String),
}

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

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