aboutsummaryrefslogtreecommitdiff
path: root/crates/proc_macro_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/proc_macro_api/src')
-rw-r--r--crates/proc_macro_api/src/process.rs8
-rw-r--r--crates/proc_macro_api/src/rpc.rs34
2 files changed, 21 insertions, 21 deletions
diff --git a/crates/proc_macro_api/src/process.rs b/crates/proc_macro_api/src/process.rs
index 51ffcaa78..907cb3db7 100644
--- a/crates/proc_macro_api/src/process.rs
+++ b/crates/proc_macro_api/src/process.rs
@@ -30,7 +30,7 @@ pub(crate) struct ProcMacroProcessThread {
30} 30}
31 31
32impl ProcMacroProcessSrv { 32impl ProcMacroProcessSrv {
33 pub fn run( 33 pub(crate) fn run(
34 process_path: PathBuf, 34 process_path: PathBuf,
35 args: impl IntoIterator<Item = impl AsRef<OsStr>>, 35 args: impl IntoIterator<Item = impl AsRef<OsStr>>,
36 ) -> io::Result<(ProcMacroProcessThread, ProcMacroProcessSrv)> { 36 ) -> io::Result<(ProcMacroProcessThread, ProcMacroProcessSrv)> {
@@ -48,7 +48,7 @@ impl ProcMacroProcessSrv {
48 Ok((thread, srv)) 48 Ok((thread, srv))
49 } 49 }
50 50
51 pub fn find_proc_macros( 51 pub(crate) fn find_proc_macros(
52 &self, 52 &self,
53 dylib_path: &Path, 53 dylib_path: &Path,
54 ) -> Result<Vec<(String, ProcMacroKind)>, tt::ExpansionError> { 54 ) -> Result<Vec<(String, ProcMacroKind)>, tt::ExpansionError> {
@@ -58,7 +58,7 @@ impl ProcMacroProcessSrv {
58 Ok(result.macros) 58 Ok(result.macros)
59 } 59 }
60 60
61 pub fn custom_derive( 61 pub(crate) fn custom_derive(
62 &self, 62 &self,
63 dylib_path: &Path, 63 dylib_path: &Path,
64 subtree: &Subtree, 64 subtree: &Subtree,
@@ -75,7 +75,7 @@ impl ProcMacroProcessSrv {
75 Ok(result.expansion) 75 Ok(result.expansion)
76 } 76 }
77 77
78 pub fn send_task<R>(&self, req: Request) -> Result<R, tt::ExpansionError> 78 pub(crate) fn send_task<R>(&self, req: Request) -> Result<R, tt::ExpansionError>
79 where 79 where
80 R: TryFrom<Response, Error = &'static str>, 80 R: TryFrom<Response, Error = &'static str>,
81 { 81 {
diff --git a/crates/proc_macro_api/src/rpc.rs b/crates/proc_macro_api/src/rpc.rs
index 47624163e..203109ca4 100644
--- a/crates/proc_macro_api/src/rpc.rs
+++ b/crates/proc_macro_api/src/rpc.rs
@@ -75,18 +75,18 @@ struct TokenIdDef(u32);
75#[serde(remote = "Delimiter")] 75#[serde(remote = "Delimiter")]
76struct DelimiterDef { 76struct DelimiterDef {
77 #[serde(with = "TokenIdDef")] 77 #[serde(with = "TokenIdDef")]
78 pub id: TokenId, 78 id: TokenId,
79 #[serde(with = "DelimiterKindDef")] 79 #[serde(with = "DelimiterKindDef")]
80 pub kind: DelimiterKind, 80 kind: DelimiterKind,
81} 81}
82 82
83#[derive(Serialize, Deserialize)] 83#[derive(Serialize, Deserialize)]
84#[serde(remote = "Subtree")] 84#[serde(remote = "Subtree")]
85struct SubtreeDef { 85struct SubtreeDef {
86 #[serde(default, with = "opt_delimiter_def")] 86 #[serde(default, with = "opt_delimiter_def")]
87 pub delimiter: Option<Delimiter>, 87 delimiter: Option<Delimiter>,
88 #[serde(with = "vec_token_tree")] 88 #[serde(with = "vec_token_tree")]
89 pub token_trees: Vec<TokenTree>, 89 token_trees: Vec<TokenTree>,
90} 90}
91 91
92#[derive(Serialize, Deserialize)] 92#[derive(Serialize, Deserialize)]
@@ -112,19 +112,19 @@ enum LeafDef {
112#[derive(Serialize, Deserialize)] 112#[derive(Serialize, Deserialize)]
113#[serde(remote = "Literal")] 113#[serde(remote = "Literal")]
114struct LiteralDef { 114struct LiteralDef {
115 pub text: SmolStr, 115 text: SmolStr,
116 #[serde(with = "TokenIdDef")] 116 #[serde(with = "TokenIdDef")]
117 pub id: TokenId, 117 id: TokenId,
118} 118}
119 119
120#[derive(Serialize, Deserialize)] 120#[derive(Serialize, Deserialize)]
121#[serde(remote = "Punct")] 121#[serde(remote = "Punct")]
122struct PunctDef { 122struct PunctDef {
123 pub char: char, 123 char: char,
124 #[serde(with = "SpacingDef")] 124 #[serde(with = "SpacingDef")]
125 pub spacing: Spacing, 125 spacing: Spacing,
126 #[serde(with = "TokenIdDef")] 126 #[serde(with = "TokenIdDef")]
127 pub id: TokenId, 127 id: TokenId,
128} 128}
129 129
130#[derive(Serialize, Deserialize)] 130#[derive(Serialize, Deserialize)]
@@ -137,16 +137,16 @@ enum SpacingDef {
137#[derive(Serialize, Deserialize)] 137#[derive(Serialize, Deserialize)]
138#[serde(remote = "Ident")] 138#[serde(remote = "Ident")]
139struct IdentDef { 139struct IdentDef {
140 pub text: SmolStr, 140 text: SmolStr,
141 #[serde(with = "TokenIdDef")] 141 #[serde(with = "TokenIdDef")]
142 pub id: TokenId, 142 id: TokenId,
143} 143}
144 144
145mod opt_delimiter_def { 145mod opt_delimiter_def {
146 use super::{Delimiter, DelimiterDef}; 146 use super::{Delimiter, DelimiterDef};
147 use serde::{Deserialize, Deserializer, Serialize, Serializer}; 147 use serde::{Deserialize, Deserializer, Serialize, Serializer};
148 148
149 pub fn serialize<S>(value: &Option<Delimiter>, serializer: S) -> Result<S::Ok, S::Error> 149 pub(super) fn serialize<S>(value: &Option<Delimiter>, serializer: S) -> Result<S::Ok, S::Error>
150 where 150 where
151 S: Serializer, 151 S: Serializer,
152 { 152 {
@@ -155,7 +155,7 @@ mod opt_delimiter_def {
155 value.as_ref().map(Helper).serialize(serializer) 155 value.as_ref().map(Helper).serialize(serializer)
156 } 156 }
157 157
158 pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Delimiter>, D::Error> 158 pub(super) fn deserialize<'de, D>(deserializer: D) -> Result<Option<Delimiter>, D::Error>
159 where 159 where
160 D: Deserializer<'de>, 160 D: Deserializer<'de>,
161 { 161 {
@@ -170,7 +170,7 @@ mod opt_subtree_def {
170 use super::{Subtree, SubtreeDef}; 170 use super::{Subtree, SubtreeDef};
171 use serde::{Deserialize, Deserializer, Serialize, Serializer}; 171 use serde::{Deserialize, Deserializer, Serialize, Serializer};
172 172
173 pub fn serialize<S>(value: &Option<Subtree>, serializer: S) -> Result<S::Ok, S::Error> 173 pub(super) fn serialize<S>(value: &Option<Subtree>, serializer: S) -> Result<S::Ok, S::Error>
174 where 174 where
175 S: Serializer, 175 S: Serializer,
176 { 176 {
@@ -179,7 +179,7 @@ mod opt_subtree_def {
179 value.as_ref().map(Helper).serialize(serializer) 179 value.as_ref().map(Helper).serialize(serializer)
180 } 180 }
181 181
182 pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<Subtree>, D::Error> 182 pub(super) fn deserialize<'de, D>(deserializer: D) -> Result<Option<Subtree>, D::Error>
183 where 183 where
184 D: Deserializer<'de>, 184 D: Deserializer<'de>,
185 { 185 {
@@ -194,7 +194,7 @@ mod vec_token_tree {
194 use super::{TokenTree, TokenTreeDef}; 194 use super::{TokenTree, TokenTreeDef};
195 use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer}; 195 use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer};
196 196
197 pub fn serialize<S>(value: &Vec<TokenTree>, serializer: S) -> Result<S::Ok, S::Error> 197 pub(super) fn serialize<S>(value: &Vec<TokenTree>, serializer: S) -> Result<S::Ok, S::Error>
198 where 198 where
199 S: Serializer, 199 S: Serializer,
200 { 200 {
@@ -209,7 +209,7 @@ mod vec_token_tree {
209 seq.end() 209 seq.end()
210 } 210 }
211 211
212 pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<TokenTree>, D::Error> 212 pub(super) fn deserialize<'de, D>(deserializer: D) -> Result<Vec<TokenTree>, D::Error>
213 where 213 where
214 D: Deserializer<'de>, 214 D: Deserializer<'de>,
215 { 215 {