2
2
//!
3
3
//! We separate proc-macro expanding logic to an extern program to allow
4
4
//! different implementations (e.g. wasm or dylib loading). And this crate
5
- //! is used for provide basic infra-structure for commnicate between two
6
- //! process : Client (RA itself), Server (the external program)
5
+ //! is used to provide basic infrastructure for communication between two
6
+ //! processes : Client (RA itself), Server (the external program)
7
7
8
8
use ra_mbe:: ExpandError ;
9
9
use ra_tt:: Subtree ;
@@ -18,7 +18,7 @@ trait ProcMacroExpander: std::fmt::Debug + Send + Sync + std::panic::RefUnwindSa
18
18
19
19
#[ derive( Debug , Clone , PartialEq , Eq ) ]
20
20
pub struct ProcMacroProcessExpander {
21
- process_path : PathBuf ,
21
+ process : Arc < ProcMacroProcessSrv > ,
22
22
}
23
23
24
24
impl ProcMacroExpander for ProcMacroProcessExpander {
@@ -34,7 +34,7 @@ impl ProcMacroExpander for ProcMacroProcessExpander {
34
34
35
35
#[ derive( Debug , Clone ) ]
36
36
pub struct ProcMacro {
37
- expander : Arc < Box < dyn ProcMacroExpander > > ,
37
+ expander : Arc < dyn ProcMacroExpander > ,
38
38
name : String ,
39
39
}
40
40
@@ -55,16 +55,21 @@ impl ProcMacro {
55
55
}
56
56
}
57
57
58
+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
59
+ pub struct ProcMacroProcessSrv {
60
+ path : PathBuf ,
61
+ }
62
+
58
63
#[ derive( Debug , Clone , PartialEq , Eq ) ]
59
64
pub enum ProcMacroClient {
60
- Process { expander : Arc < ProcMacroProcessExpander > } ,
65
+ Process { process : Arc < ProcMacroProcessSrv > } ,
61
66
Dummy ,
62
67
}
63
68
64
69
impl ProcMacroClient {
65
70
pub fn extern_process ( process_path : & Path ) -> ProcMacroClient {
66
- let expander = ProcMacroProcessExpander { process_path : process_path. into ( ) } ;
67
- ProcMacroClient :: Process { expander : Arc :: new ( expander ) }
71
+ let process = ProcMacroProcessSrv { path : process_path. into ( ) } ;
72
+ ProcMacroClient :: Process { process : Arc :: new ( process ) }
68
73
}
69
74
70
75
pub fn dummy ( ) -> ProcMacroClient {
0 commit comments