File: forward_allow_attr.rs

package info (click to toggle)
rust-derive-builder 0.20.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 500 kB
  • sloc: makefile: 2
file content (24 lines) | stat: -rw-r--r-- 587 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#![deny(non_snake_case)]

#[macro_use]
extern crate derive_builder;

#[derive(Builder)]
// If this attribute is not forwarded to both the struct and the impl block, there would
// be a compile error on either the field or the setter method name. Therefore, forwarding
// is working as-expected if this test compiles.
#[allow(non_snake_case)]
pub struct Example {
    aPascalName: &'static str,
}

fn main() {
    assert_eq!(
        ExampleBuilder::default()
            .aPascalName("hello")
            .build()
            .unwrap()
            .aPascalName,
        "hello"
    );
}