33pub mod intercept;
44pub mod semantic;
55
6- use crate :: intercept:: persistence:: { read , write } ;
6+ use crate :: intercept:: persistence;
77use crate :: modes:: intercept:: BuildInterceptor ;
88use crate :: modes:: semantic:: SemanticAnalysisPipeline ;
99use crate :: { args, config} ;
@@ -27,7 +27,7 @@ pub struct Intercept {
2727
2828impl Intercept {
2929 /// Create a new intercept mode instance.
30- pub fn from (
30+ pub fn create (
3131 command : args:: BuildCommand ,
3232 output : args:: BuildEvents ,
3333 config : config:: Main ,
@@ -41,8 +41,9 @@ impl Intercept {
4141 . map ( io:: BufWriter :: new)
4242 . with_context ( || format ! ( "Failed to open file: {:?}" , file_name) ) ?;
4343
44- let interceptor =
45- BuildInterceptor :: new ( config, move |envelopes| write ( output_file, envelopes) ) ?;
44+ let interceptor = BuildInterceptor :: create ( config, move |events| {
45+ persistence:: write ( output_file, events)
46+ } ) ?;
4647
4748 Ok ( Self {
4849 command,
@@ -70,7 +71,7 @@ pub struct Semantic {
7071}
7172
7273impl Semantic {
73- pub fn from (
74+ pub fn create (
7475 input : args:: BuildEvents ,
7576 output : args:: BuildSemantic ,
7677 config : config:: Main ,
@@ -82,7 +83,7 @@ impl Semantic {
8283 . map ( BufReader :: new)
8384 . with_context ( || format ! ( "Failed to open file: {:?}" , file_name) ) ?;
8485
85- let semantic = SemanticAnalysisPipeline :: from ( output, & config) ?;
86+ let semantic = SemanticAnalysisPipeline :: create ( output, & config) ?;
8687
8788 Ok ( Self {
8889 event_file,
@@ -97,7 +98,7 @@ impl Mode for Semantic {
9798 /// The exit code is based on the result of the output writer.
9899 fn run ( self ) -> anyhow:: Result < ExitCode > {
99100 self . semantic
100- . analyze_and_write ( read ( self . event_file ) )
101+ . analyze_and_write ( persistence :: read ( self . event_file ) )
101102 . map ( |_| ExitCode :: SUCCESS )
102103 }
103104}
@@ -110,15 +111,14 @@ pub struct Combined {
110111
111112impl Combined {
112113 /// Create a new all mode instance.
113- pub fn from (
114+ pub fn create (
114115 command : args:: BuildCommand ,
115116 output : args:: BuildSemantic ,
116117 config : config:: Main ,
117118 ) -> anyhow:: Result < Self > {
118- let semantic = SemanticAnalysisPipeline :: from ( output, & config) ?;
119- let interceptor = BuildInterceptor :: new ( config, move |envelopes| {
120- semantic. analyze_and_write ( envelopes)
121- } ) ?;
119+ let semantic = SemanticAnalysisPipeline :: create ( output, & config) ?;
120+ let interceptor =
121+ BuildInterceptor :: create ( config, move |events| semantic. analyze_and_write ( events) ) ?;
122122
123123 Ok ( Self {
124124 command,
0 commit comments