@@ -23,6 +23,7 @@ extern crate syn;
2323extern crate quote;
2424
2525use proc_macro2:: TokenStream ;
26+ use syn:: Visibility ;
2627
2728/// Derive-related code. This will be moved into graphql_query_derive.
2829pub mod attributes;
@@ -71,6 +72,8 @@ pub struct GraphQLClientDeriveOptions {
7172 pub additional_derives : Option < String > ,
7273 /// The deprecation strategy to adopt.
7374 pub deprecation_strategy : Option < deprecation:: DeprecationStrategy > ,
75+ /// target struct visibility.
76+ pub module_visibility : Visibility ,
7477}
7578
7679/// Generates the code for a Rust module given a query, a schema and options.
@@ -81,6 +84,7 @@ pub fn generate_module_token_stream(
8184) -> Result < TokenStream , failure:: Error > {
8285 let options = options. unwrap ( ) ;
8386
87+ let module_visibility = options. module_visibility ;
8488 let response_derives = options. additional_derives ;
8589
8690 // The user can determine what to do about deprecations.
@@ -155,7 +159,7 @@ pub fn generate_module_token_stream(
155159 ) ?;
156160
157161 let result = quote ! (
158- pub mod #module_name {
162+ #module_visibility mod #module_name {
159163 #![ allow( non_camel_case_types) ]
160164 #![ allow( non_snake_case) ]
161165 #![ allow( dead_code) ]
0 commit comments