ironsnake_simple/
lib.rs

1use std::collections::HashMap;
2
3pub fn five() -> i32 {
4    5
5}
6
7pub fn create_tuple() -> (String, i32, f64) {
8    ("Hello, World!".to_string(), 42, 3.14)
9}
10
11pub struct Aggregate {
12    pub int: i32,
13    pub float_number: f64,
14    pub text: String,
15    pub list: Vec<f64>,
16    pub tuple_data: (bool, i64),
17    pub map: HashMap<String, i32>,
18}
19
20impl Aggregate {
21    pub fn new() -> Self {
22        let mut map = HashMap::new();
23        map.insert("one".to_string(), 1);
24        map.insert("two".to_string(), 2);
25
26        Aggregate {
27            int: 42,
28            float_number: 3.14,
29            text: "Hello, Python!".to_string(),
30            list: vec![1.1, 2.2, 3.3],
31            tuple_data: (true, 1234567890),
32            map,
33        }
34    }
35}
36
37pub struct Person {
38    pub name: String,
39    pub age: u32,
40}
41
42impl Person {
43    pub fn new(name: &str, age: u32) -> Self {
44        Person {
45            name: name.to_string(),
46            age,
47        }
48    }
49}
50
51pub fn generate_person() -> Person {
52    Person::new("Alice", 30)
53}