Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #[derive(Debug)]
  2. struct St {
  3. a: String,
  4. b: i64
  5. }
  6.  
  7. impl St {
  8. pub fn new() -> Self {
  9. Self {
  10. a: "a".to_string(),
  11. b: 4
  12. }
  13. }
  14. pub fn a(&mut self, a: String) -> &mut Self {
  15. self.a = a;
  16. self
  17. }
  18. pub fn b(&mut self, b: i64) -> &mut Self {
  19. self.b = b;
  20. self
  21. }
  22. }
  23.  
  24. fn main() {
  25. println!("{:?}", St::new().b(23))
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement