Ok, after reading some comments on other places, I think I get it now. While you are free to use their open sourced tool chain, which is what they have certified, you still doesn’t fulfilling the legal requirements unless you buy the certified tool chain. Just because it is open source, doesn’t legally guarantee that is what’s certified.
So, you pay to get the legal status of the certification. Did I understand this somewhat correct?
And the Copy question.It is not that s reference has to implement Copy. A reference IS Copy, by the simple fact that it is a primitive value on the stack.
A reference &T holds a pointer, ie. the memory adress to the actual content of T
So, in the example x doesn’t hold the value 42, it holds the memory adress to the memory there the integer value 42 is stored. So, to access the value, you need to dereference the reference. Which is why you need to use *x when you assign the value.
Because of ownership you’re forced into certain hierarchies, which make the code ugly and hard to read.
For non-gc languages you always have ownership, in most languages you just have to keep track of it manually. And whenever the rust compiler gives an error, you would most likely have had a future issue in another language. For gc languages, this may still exist if you share data between threads, causing possilbe race conditions and data corruption. So, the ownership/borrow model is just a formalization of implicit rules that exists in most languages.
I see where you come from. I first turned to Go, but at the end of the day it was a nice language but it didn’t tick my boxes. One of my main issues for backend servers, is for them to be robust. They should never fail in runtime. That means error handling is quite important, and as few runtime errors as possible. Go, fails this hard. The strictness of Rust, may be a pain while learning, and some syntax may be less than optimal, but the result will almost never fail in production. I have in fact never had a backend I wrote fail in production. The error handling also makes it easy to find any errors due to things out of my control. I switched a project from Java to Rust, and the log shrunk by a factor 10.
Note, I still use Go sometimes, but it is not my go to language. And on a second note, that you point to .unwrap() indicates that you never really used rust to write a backend, since use of .unwrap() will panik if you use that. You normally use .unwrap_or(…) or some other better construct. Also, complaining about unwrap() would indicate that you prefer a null pointer issue? Because, dropping null/nil is one of the great design choices, having null/nil is just a recepie for getting a runtime crash.
wouldn’t it be better to use
#[cfg(target_os = "windows")]
instead of checking an env variable?
Reference: https://doc.rust-lang.org/rust-by-example/attribute/cfg.html
Now, I don’t have any experience with Axum, but my experience is that the frameworks are quite similar, so much of the porting tend to be in parameters and types, authentication and session (of course, this may vary from project to project). So if you are familiar with Axum this might be a good way to start contributing to Kellnr. Well, I guess if you just want to learn Axum, it might also be a good way to start, it will just be a little slower… but I guess it is a good way to learn a new framework if you have the time to invest.
That depends on the job I want to do. But generally my selection is something like this.
Preferred backend language, Rust, since that have the least runtime errors, thanks to its strong typing and the great error handling. But I also use Go if it have better libs for what I do, or Java for situations where that is more suitable.
That is all dependent on the program, but the simplest scenario is by an API with two requests at the same time. But it may also be like if you scan for new files, and use inotify, then you may also have a scanning loop as a fallback. Then the scan and inotify may trigger at almost the same time, so if that then results in a db create or insert you can get in to this problem. So, there are multiple ways to get in to trouble, and life always find new ways 😀
You are free to see this as an ad, but as Rust is targeting safety critical programming in general, I find it interesting to follow certification efforts like this to make rust available for really safety critical use cases. Now, the Ferrocene project is contributing back, but that fact or the license does not really affect the relevance for this community.
Well, of course you should stick to rustc if you don’t need the certification. I get the impression you mix up thing and the purpose of a certified compiler.
Ferrous Systems is working on certifying a specific version of rustc, and hence make it possible to use rust for projects where such certification is required. And certification is required for things like programming medical equipment. If you are hooked in to life support, it is good if the compiler did the thing it was supposed to do… a crash in such programs can be fatal in a very literal way.
Also, notice that they try to do this without forking and by contributing upstream.
As I still run in to glibc version issues a little now and then (admittedly not very often, thankss to containers), I hope to see rust getting rid of libc one day. But I don’t expect that in the near future, because as the author mentions, libc is very mature, so replacing it must be done with a lot of caution. But this really looks like a step in the right direction.
I think this is was a great read, since it shows a few important things
That will always be prune to race conditions, where you check if someting exists (then some other thread creates it) and then you try to create it. You should always try to create first, then if it fails due to it already existing, fetch it. That is a good general rule for anything from hashmaps to databases.
The reason might be, that you must think a bit different from C++ so it might be a little bit tricky to do the switch. Thouigh, if you know C++ the ownership and stuff should be a bit easier to understand since you probably can figure out what is going on. The reason I learned Rust in the first place was because I had to use C libraries, and I knew rust had good support for that. But, unfortunately I cannot assist you with alternatives to rust, since I stopped looking after I learned rust. 😄
And don’t get me wrong, I think Go is ok and I use it from time to time. When Go and Rust started to get traction, I actually laughed at Rust thinking it was a stupid language. Why would anyone use Rust when you had Go, it sounded so great with its go routines and all. I then started to use it, and it wasn’t bad, but it wasn’t something that got me all excited either. And it was the horrible error handling and all these simplifications that sacrifices correctness that made me feel it was only an ok language. It is the correctness of Rust and that you have to handle all errors aso, that makes it a bit annoying, but it is also these things that makes it great.
I think this old article exemplify the bad design of Go, and why I think Rust is very well designed.
TL;DR Go takes many shortcuts, in the name of simplicity, that ends up with pure lies. Like providing Unix like permissions for Windows and silently ignore it.
https://fasterthanli.me/articles/i-want-off-mr-golangs-wild-ride
Why are you doing
I don’t see that you mutate card anywhere, am I missing something?