summaryrefslogtreecommitdiff
path: root/examples/02-sum/output/rust/src/shapes.rs
blob: 1d2d00fa9d1b0352e4e4f72bb28f469bdd5021ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Generated by hobgoblin.

/// A 2D shape.
#[derive(Debug, PartialEq)]
pub enum Shape {
    Rectangle(crate::shapes::Rectangle),
    Triangle(crate::shapes::Triangle),
}

impl ::std::convert::From::<crate::shapes::Rectangle> for crate::shapes::Shape {
    fn from(value: crate::shapes::Rectangle) -> Self {
        Self::Rectangle(value)
    }
}

impl ::std::convert::From::<crate::shapes::Triangle> for crate::shapes::Shape {
    fn from(value: crate::shapes::Triangle) -> Self {
        Self::Triangle(value)
    }
}

#[derive(Debug, PartialEq)]
pub struct Rectangle {
    pub width: ::core::primitive::i32,
    pub height: ::core::primitive::i32,
}

#[derive(Debug, PartialEq)]
pub struct Triangle {
    pub width: ::core::primitive::i32,
    pub height: ::core::primitive::i32,
}