Is it correct to assume that when you find what you want to build, you first check for the existence of crates that could make your job easier, and after that you look for a way of tying them together to end up with what you want?
@JeremyChone2 жыл бұрын
First, the goal of this video was to be an end-to-end tutorial and not a library that others should or would use. Now, the "not re-inventing the wheel" mantra would deserve a more profound discussion, and, unfortunately, it is not as straightforward as it intuitively looks. In a professional setup, we obviously do not want to redo everything, but at the same time, going to the other extreme and just "gluing" existing related technologies together might put the project/product on the wrong path as well. So, it's a balanced exercise. The core principles I have developed over the years are: - Simple Scales Better - Runtime or Libraries over Frameworks - Learn What Matters When I get more time, I will try to make a video tackling this topic. In the meantime, while learning a language, especially Rust, I would recommend developers not to worry too much about this topic. Instead, code what your brain is excited about, use what you think should be used, and do not worry about what others might say.... just be happy coding. Also, Rust has a very cool (cargo install --path .) which allows you to code and install your own command line on your system without publishing it. Combined with cargo watch, it can be very effective to make focused, solo use command lines.
@Vancha1122 жыл бұрын
@@JeremyChone If you'd want to make a video on this, that'd be awesome. I guess I try to generalize too much, because it's hard to know how to get from an idea to a program. The idea behind this video is clear though, It's clear how it all fits together without using any obscure functions to make it hard for beginners,do it's been really helpful. I'll try coming up with a practice program, maybe something to do with chess or something ^^ thanks!
@JeremyChone2 жыл бұрын
Your point was a valid one. When I made this tutorial, I questioned myself about "polluting" the crates.io, but I concluded the end-to-end example was worthwhile. The question about the "what to use" and "when to use it" is a very hard one, and in fact, I believe that this is where most of the "magic" happens for successful projects. There are some fantastic libs and technology, but at the same time, there is a lot of noise, hype, and popular misuses, that if followed, can put a project on a dead path before it even gets started.
@VivekYadav-ds8oz3 жыл бұрын
Can you explain the difference b/w .map_err() and .or_else()?
@JeremyChone3 жыл бұрын
result.map_err... is to return a different Error if result was an error. result.or_else... is to return the same Result type (err or ok) if result was an error.
@jonathanmoore56193 жыл бұрын
Thank you.
@hamzamohd.zubair17093 жыл бұрын
Excellent Stuff! Isn't anyhow::Error better than Box
@JeremyChone3 жыл бұрын
Yes, you are right. Actually I use thiserror for all my apps. Same lib author, a little bit more structured, but still remove a lot of boilerplate code. I might do an update of this crate with this patterned some point.