diff options
Diffstat (limited to 'examples/05-native-type-custom-config')
7 files changed, 44 insertions, 0 deletions
diff --git a/examples/05-native-type-custom-config/hobgoblin.json5 b/examples/05-native-type-custom-config/hobgoblin.json5 index 1c92a49..f925903 100644 --- a/examples/05-native-type-custom-config/hobgoblin.json5 +++ b/examples/05-native-type-custom-config/hobgoblin.json5 @@ -10,12 +10,24 @@ }, ], }, + rust: { + nativeTypes: [ + { + hobgoblin: "point.Point", + rust: "crate::Point", + }, + ], + }, }, generators: [ { generator: "java-types", path: "output/java/src/gen/java", }, + { + generator: "rust-types", + path: "output/rust/src", + }, ], }, } diff --git a/examples/05-native-type-custom-config/output/rust/.gitignore b/examples/05-native-type-custom-config/output/rust/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/.gitignore @@ -0,0 +1 @@ +/target diff --git a/examples/05-native-type-custom-config/output/rust/Cargo.lock b/examples/05-native-type-custom-config/output/rust/Cargo.lock new file mode 100644 index 0000000..9dc6e3e --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "example" +version = "0.1.0" diff --git a/examples/05-native-type-custom-config/output/rust/Cargo.toml b/examples/05-native-type-custom-config/output/rust/Cargo.toml new file mode 100644 index 0000000..5d4c622 --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "example" +version = "0.1.0" +edition = "2024" + +[dependencies] diff --git a/examples/05-native-type-custom-config/output/rust/rust-toolchain.toml b/examples/05-native-type-custom-config/output/rust/rust-toolchain.toml new file mode 100644 index 0000000..4fedb95 --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/rust-toolchain.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "1.96" diff --git a/examples/05-native-type-custom-config/output/rust/src/main.rs b/examples/05-native-type-custom-config/output/rust/src/main.rs new file mode 100644 index 0000000..af7be7f --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/src/main.rs @@ -0,0 +1,9 @@ +mod point; + +use point::Line; + +struct Point(i32, i32); + +fn main() { + let line = Line { start: Point(10, 25), end: Point(25, 10) }; +} diff --git a/examples/05-native-type-custom-config/output/rust/src/point.rs b/examples/05-native-type-custom-config/output/rust/src/point.rs new file mode 100644 index 0000000..b073f86 --- /dev/null +++ b/examples/05-native-type-custom-config/output/rust/src/point.rs @@ -0,0 +1,7 @@ +// Generated by hobgoblin. + +/// A straight line from one point to another. +pub struct Line { + pub start: crate::Point, + pub end: crate::Point, +} |
