typeshare_java/
config.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Serialize, Deserialize)]
6#[serde(default)]
7pub struct JavaConfig {
8    /// The header comment to prepend to generated files
9    pub header_comment: HeaderComment,
10    /// Name of the Java package
11    pub package: Option<String>,
12    /// The prefix to append to user-defined types
13    pub prefix: Option<String>,
14    /// Conversions from Rust type names to Java type names
15    pub type_mappings: HashMap<String, String>,
16}
17
18impl Default for JavaConfig {
19    fn default() -> Self {
20        Self {
21            header_comment: HeaderComment::None,
22            package: None,
23            prefix: None,
24            type_mappings: HashMap::with_capacity(0),
25        }
26    }
27}
28
29#[derive(Debug, Serialize, Deserialize)]
30#[serde(tag = "type")]
31pub enum HeaderComment {
32    None,
33    Custom { comment: String },
34    Default,
35}