@@ -23,6 +23,7 @@ extern crate syn;
23
23
extern crate quote;
24
24
25
25
use proc_macro2:: TokenStream ;
26
+ use syn:: Visibility ;
26
27
27
28
/// Derive-related code. This will be moved into graphql_query_derive.
28
29
pub mod attributes;
@@ -71,6 +72,8 @@ pub struct GraphQLClientDeriveOptions {
71
72
pub additional_derives : Option < String > ,
72
73
/// The deprecation strategy to adopt.
73
74
pub deprecation_strategy : Option < deprecation:: DeprecationStrategy > ,
75
+ /// target struct visibility.
76
+ pub module_visibility : Visibility ,
74
77
}
75
78
76
79
/// Generates the code for a Rust module given a query, a schema and options.
@@ -81,6 +84,7 @@ pub fn generate_module_token_stream(
81
84
) -> Result < TokenStream , failure:: Error > {
82
85
let options = options. unwrap ( ) ;
83
86
87
+ let module_visibility = options. module_visibility ;
84
88
let response_derives = options. additional_derives ;
85
89
86
90
// The user can determine what to do about deprecations.
@@ -155,7 +159,7 @@ pub fn generate_module_token_stream(
155
159
) ?;
156
160
157
161
let result = quote ! (
158
- pub mod #module_name {
162
+ #module_visibility mod #module_name {
159
163
#![ allow( non_camel_case_types) ]
160
164
#![ allow( non_snake_case) ]
161
165
#![ allow( dead_code) ]
0 commit comments