summaryrefslogtreecommitdiff
path: root/src/codegen/helpers.rs
diff options
context:
space:
mode:
authoruk <50893351+unterkontrolle@users.noreply.github.com>2019-06-10 15:16:19 -0300
committeruk <50893351+unterkontrolle@users.noreply.github.com>2019-06-10 15:16:19 -0300
commitccc43cd24e66263587fbcc0ad6161c7efa18a413 (patch)
treee373a4d91c1e2fbadb26c07bfab12acd5833a5b4 /src/codegen/helpers.rs
parent6aa5b2b4222f5a95270f630defab633f8ac57bc0 (diff)
Add support for non_exhaustive rustified enums.
Implements the feature discussed in https://github.com/rust-lang/rust-bindgen/issues/1554.
Diffstat (limited to 'src/codegen/helpers.rs')
-rw-r--r--src/codegen/helpers.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs
index b630a70b..1e8534ee 100644
--- a/src/codegen/helpers.rs
+++ b/src/codegen/helpers.rs
@@ -42,6 +42,12 @@ pub mod attributes {
}
}
+ pub fn non_exhaustive() -> TokenStream {
+ quote! {
+ #[non_exhaustive]
+ }
+ }
+
pub fn doc(comment: String) -> TokenStream {
// NOTE(emilio): By this point comments are already preprocessed and in
// `///` form. Quote turns them into `#[doc]` comments, but oh well.