Ad
Code
Diff
  • fn foo() -> i32 {
        42
    }
    • fn foo() -> i32 {
    • 2
    • 42
    • }
Code
Diff
  • struct Person {
        first_name: String,
        last_name: String,
    }
    
    impl Person {
        fn new(first_name: String, last_name: String) -> Self {
            Person {
                first_name,
                last_name,
            }
        }
        
        fn greet(&self) -> String {
            format!("Hello, my name is {} {}", self.first_name, self.last_name)
        }
    }
    • struct Person {
    • first_name: String,
    • last_name: String,
    • first_name: String,
    • last_name: String,
    • }
    • impl Person {
    • fn new(first_name: String, last_name: String) -> Self {
    • Person {first_name, last_name}
    • Person {
    • first_name,
    • last_name,
    • }
    • }
    • fn greet(&self) -> String {
    • format!("Hello, my name is {} {}", self.first_name, self.last_name)
    • }
    • }