diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-07-24 18:05:02 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-07-24 18:05:02 +0100 |
| commit | 2409a40985dad843fe25611c9cd14afdac6d67bf (patch) | |
| tree | d9ba9fb0a542eba85a0c6aa35e57bfb21ac39600 /examples/08-shared/output/rust/src | |
| parent | 2bc23bdc7fe01fc5921be8e09f405a8a1fd7bd65 (diff) | |
Support Shared in rust-types
Diffstat (limited to 'examples/08-shared/output/rust/src')
| -rw-r--r-- | examples/08-shared/output/rust/src/lib.rs | 14 | ||||
| -rw-r--r-- | examples/08-shared/output/rust/src/point.rs | 15 |
2 files changed, 29 insertions, 0 deletions
diff --git a/examples/08-shared/output/rust/src/lib.rs b/examples/08-shared/output/rust/src/lib.rs new file mode 100644 index 0000000..af2c87f --- /dev/null +++ b/examples/08-shared/output/rust/src/lib.rs @@ -0,0 +1,14 @@ +mod point; + +#[cfg(test)] +mod test { + use std::sync::Arc; + use super::point::{Line, Point}; + + #[test] + fn line() { + let point = Arc::new(Point { x: 10, y: 25 }); + let line = Line { start: Arc::clone(&point), end: point }; + assert_eq!(line.start.x, 10); + } +} diff --git a/examples/08-shared/output/rust/src/point.rs b/examples/08-shared/output/rust/src/point.rs new file mode 100644 index 0000000..ef7593b --- /dev/null +++ b/examples/08-shared/output/rust/src/point.rs @@ -0,0 +1,15 @@ +// Generated by hobgoblin. + +/// A straight line from one point to another. +#[derive(Debug, PartialEq)] +pub struct Line { + pub start: ::std::sync::Arc::<crate::point::Point>, + pub end: ::std::sync::Arc::<crate::point::Point>, +} + +/// A 2D point. +#[derive(Debug, PartialEq)] +pub struct Point { + pub x: ::core::primitive::i32, + pub y: ::core::primitive::i32, +} |
