22//!
33//! We separate proc-macro expanding logic to an extern program to allow
44//! 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)
77
88use ra_mbe:: ExpandError ;
99use ra_tt:: Subtree ;
@@ -18,7 +18,7 @@ trait ProcMacroExpander: std::fmt::Debug + Send + Sync + std::panic::RefUnwindSa
1818
1919#[ derive( Debug , Clone , PartialEq , Eq ) ]
2020pub struct ProcMacroProcessExpander {
21- process_path : PathBuf ,
21+ process : Arc < ProcMacroProcessSrv > ,
2222}
2323
2424impl ProcMacroExpander for ProcMacroProcessExpander {
@@ -34,7 +34,7 @@ impl ProcMacroExpander for ProcMacroProcessExpander {
3434
3535#[ derive( Debug , Clone ) ]
3636pub struct ProcMacro {
37- expander : Arc < Box < dyn ProcMacroExpander > > ,
37+ expander : Arc < dyn ProcMacroExpander > ,
3838 name : String ,
3939}
4040
@@ -55,16 +55,21 @@ impl ProcMacro {
5555 }
5656}
5757
58+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
59+ pub struct ProcMacroProcessSrv {
60+ path : PathBuf ,
61+ }
62+
5863#[ derive( Debug , Clone , PartialEq , Eq ) ]
5964pub enum ProcMacroClient {
60- Process { expander : Arc < ProcMacroProcessExpander > } ,
65+ Process { process : Arc < ProcMacroProcessSrv > } ,
6166 Dummy ,
6267}
6368
6469impl ProcMacroClient {
6570 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 ) }
6873 }
6974
7075 pub fn dummy ( ) -> ProcMacroClient {
0 commit comments