Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[derive(Debug)]
- struct St {
- a: String,
- b: i64
- }
- impl St {
- pub fn new() -> Self {
- Self {
- a: "a".to_string(),
- b: 4
- }
- }
- pub fn a(&mut self, a: String) -> &mut Self {
- self.a = a;
- self
- }
- pub fn b(&mut self, b: i64) -> &mut Self {
- self.b = b;
- self
- }
- }
- fn main() {
- println!("{:?}", St::new().b(23))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement