pub struct CompilerConfig {
pub java_version: u32,
pub output_dir: String,
pub classpath: Vec<String>,
pub source_files: Vec<String>,
pub incremental: bool,
}Fields§
§java_version: u32§output_dir: String§classpath: Vec<String>§source_files: Vec<String>§incremental: boolImplementations§
Source§impl CompilerConfig
impl CompilerConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Examples found in repository?
examples/compiler-example.rs (line 46)
3fn main() {
4 let args: Vec<String> = std::env::args().skip(1).collect();
5 if args.is_empty() {
6 print_usage();
7 std::process::exit(2);
8 }
9
10 let mut output_dir = "target/compiler-example".to_string();
11 let mut classpath: Vec<String> = Vec::new();
12 let mut sources: Vec<String> = Vec::new();
13 let mut i = 0;
14 while i < args.len() {
15 match args[i].as_str() {
16 "--output-dir" | "-o" => {
17 i += 1;
18 if i >= args.len() {
19 eprintln!("error: --output-dir requires a value");
20 std::process::exit(2);
21 }
22 output_dir = args[i].clone();
23 i += 1;
24 }
25 "--class-path" | "--classpath" | "-classpath" | "-cp" => {
26 i += 1;
27 if i >= args.len() {
28 eprintln!("error: {} requires a value", args[i - 1]);
29 std::process::exit(2);
30 }
31 classpath.push(args[i].clone());
32 i += 1;
33 }
34 arg => {
35 sources.push(arg.to_string());
36 i += 1;
37 }
38 }
39 }
40
41 if sources.is_empty() {
42 print_usage();
43 std::process::exit(2);
44 }
45
46 let mut config = CompilerConfig::new();
47 config.output_dir = output_dir;
48 config.classpath = classpath;
49 config.source_files = sources;
50
51 if let Err(errors) = compile(config) {
52 for error in errors {
53 eprintln!("{error}");
54 }
55 std::process::exit(1);
56 }
57}Trait Implementations§
Auto Trait Implementations§
impl Freeze for CompilerConfig
impl RefUnwindSafe for CompilerConfig
impl Send for CompilerConfig
impl Sync for CompilerConfig
impl Unpin for CompilerConfig
impl UnsafeUnpin for CompilerConfig
impl UnwindSafe for CompilerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more