Something like this? play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5cb6d0dc5698d7ed189ea366d6fd4b1d
2 หลายเดือนก่อน +1
@@learning_rust Yeah, my understanding of the factory pattern is that you shouldn't worry about the exact implementation. That's where the factory comes in. But I usually use design patterns fairly loosely (when I use 'em) See my other remark on what I did with it. Your stuff is really inspiring to play with the concepts
2 หลายเดือนก่อน
@@learning_rust Yes, that was my interpretation too
Understood I'm trying to nail the theory, and then deviate/use more loosely exactly like you say, I'm going to revist "Rust in a Month of Lunches" page 244 (I'm not on any commission, but it's such a good book). Thanks for taking the time to comment 👍
Shouldn’t the factory return an instance of the Pets object instead of the trait? Seems to be a rather limited approach like this.
Ok, so return... -> impl instead?
'static dispatch'
still learning - so all advice welcomed
Something like this?
play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=5cb6d0dc5698d7ed189ea366d6fd4b1d
@@learning_rust Yeah, my understanding of the factory pattern is that you shouldn't worry about the exact implementation. That's where the factory comes in. But I usually use design patterns fairly loosely (when I use 'em) See my other remark on what I did with it. Your stuff is really inspiring to play with the concepts
@@learning_rust Yes, that was my interpretation too
Understood
I'm trying to nail the theory, and then deviate/use more loosely exactly like you say, I'm going to revist "Rust in a Month of Lunches" page 244 (I'm not on any commission, but it's such a good book).
Thanks for taking the time to comment 👍