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
/// Doc comment for the module // Line comment /* Block comment */ /* Multi-line block comment */ #[derive(Debug, Clone)] pub struct MyStruct { pub field: String, } pub fn public_fn() -> String { let msg = "hello world"; println!("{}", msg); msg.to_string() } fn private_fn() -> i32 { 42 } #[test] fn test_example() { assert_eq!(1 + 1, 2); }