From ccc43cd24e66263587fbcc0ad6161c7efa18a413 Mon Sep 17 00:00:00 2001 From: uk <50893351+unterkontrolle@users.noreply.github.com> Date: Mon, 10 Jun 2019 15:16:19 -0300 Subject: Add support for non_exhaustive rustified enums. Implements the feature discussed in https://github.com/rust-lang/rust-bindgen/issues/1554. --- src/codegen/helpers.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/codegen/helpers.rs') 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. -- cgit v1.2.3