Snippets Collections
struct MyStruct {
  isHappy: bool
}

trait Noisy {
  fn get_noise(&self) -> &str
}

impl Noisy for MyStruct {
  fn get_noise(&self) -> &str { "Meow?" }
}

****** DEFAULT TRAIT IMPL
trait Run {
  // no properties - use setter,getter
  fun run(&self) {
    // exe
  }
}
struct Robot {}
impl Run for Robot {}

fn main() {
  let robot = Robot {};
  robot.run();
}


Robot::Run::run() ??? this works ???

star

Fri Jul 22 2022 01:44:36 GMT+0000 (Coordinated Universal Time) https://www.udemy.com/course/ultimate-rust-crash-course/learn/lecture/17981939#overview

#struct

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension