Guest User

Untitled

a guest
Oct 23rd, 2019
95
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. struct Foo {
  2. bar: &'static str,
  3. }
  4.  
  5. impl Foo {
  6. fn new() -> Foo {
  7. Foo {
  8. bar: "bar",
  9. }
  10. }
  11. fn _print_bar(&mut self) {
  12. println!("{}", self.bar);
  13. }
  14. }
  15. fn main() {
  16. let mut foo = Foo::new();
  17. Foo::_print_bar(&mut foo); // Одно
  18. foo._print_bar(); // и то же
  19. }
RAW Paste Data