wit_bindgen_csharp/
lib.rs1use wit_bindgen_core::WorldGenerator;
2use wit_component::StringEncoding;
3
4mod csharp_ident;
5mod csproj;
6mod function;
7mod interface;
8mod world_generator;
9
10pub use csproj::CSProject;
11
12#[derive(Default, Debug, Clone)]
13#[cfg_attr(feature = "clap", derive(clap::Args))]
14pub struct Opts {
15 #[cfg_attr(feature = "clap", arg(long, default_value_t = StringEncoding::default()))]
16 pub string_encoding: StringEncoding,
17
18 #[cfg_attr(feature = "clap", arg(long))]
20 pub generate_stub: bool,
21
22 #[cfg_attr(feature = "clap", arg(short, long, value_enum))]
24 pub runtime: CSharpRuntime,
25
26 #[cfg_attr(feature = "clap", arg(long))]
28 pub internal: bool,
29
30 #[cfg_attr(feature = "clap", arg(long))]
32 pub skip_support_files: bool,
33
34 #[cfg_attr(feature = "clap", arg(long))]
36 pub with_wit_results: bool,
37}
38
39impl Opts {
40 pub fn build(&self) -> Box<dyn WorldGenerator> {
41 Box::new(world_generator::CSharp {
42 opts: self.clone(),
43 ..world_generator::CSharp::default()
44 })
45 }
46}
47
48#[derive(Default, Debug, Clone, Copy, PartialEq, Eq)]
49#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
50pub enum CSharpRuntime {
51 #[default]
52 NativeAOT,
53 Mono,
54}