It is well supported in all browsers and operating systems. At least VS Code and IntelliJ support it, and even some terminals.
I don’t understand the “serde2” issue. Isn’t “someusername/serde” strictly worse than “serde2”?
GitHub being the only auth provider is something the maintainers wanted to fix, but didn’t have enough bandwidth to implement. I think they would welcome contributions!
If all you do in the Err(e) => ...
match arm is returning the error, then you absolutely should use the ?
operator instead.
If the match arm also converts the error type into another error type, implement the From
trait for the conversion, then you can use ?
as well.
If you want to add more information to the error, you can use .map_err(...)?
. Or, if you’re using the anyhow
crate, .with_context(...)?
.
I can’t remember ever needing more than two question marks (??
), and even that is very rare in my experience.
Apparently the maintainer trusted the first-time contributor enough to propose tackling another bug.
There is no trust needed when asking someone to fix a bug. It’s not like the maintainer would lose anything if the contributor failed to fix the bug.
Besides, I think it is natural to want recognition when you do a lot of work for free. Many other people wouldn’t do this unpaid work at all; recognizing their contribution is the bare minimum of good manners. Even in a company where employees are paid for their work, it is customary to give credit to co-workers who have helped you. Most people don’t like to work in places where they don’t feel appreciated, and that is also true in Open-Source.
It’s not possible to instantiate or assign, which is more like a never type than a unit
Actually, this is because void
is not a type, it is just a keyword, a placeholder used instead of the return type when a function doesn’t return anything.
If it were a bottom type, that would mean that a method returning void
must diverge, which is simply not true.
Also, if it were a bottom type, it would be possible to write an “unreachable” method
void unreachable(void bottom) {
return bottom;
}
Even though it couldn’t be called, it should be possible to define it, if void
was a bottom type. But it is not, because void
isn’t a bottom type, it’s no type at all.
No it’s not, it is 100% a unit type (except it’s not really a type, since you can only use it as return type and nowhere else)
Easy interop with legacy code is how kotlin took off, so maybe it will work out?
Good interop was a requirement for widespread adoption, but not the reason why programmers want to use it. There’s also null safety, a much nicer syntax, custom DSLs, sealed classes, type inference, data classes, named and optional arguments, template strings, multi-line strings, computed properties, arbitrary-arity function types, delegation, custom operators, operator overloading, structural equality, destructuring, extension methods, inline functions and non-local control flow, reified types, …
Some of these features have since been added to Java.
It gives you more type safety, because you use a ProxyᐸFooᐳ
instead of just usize
.
Actually, it’s not a package repository (it doesn’t store crates), it’s “just” a website to display metadata from crates published on crates.io. It also shows certain information from docs.rs, GitHub, rustsec.org, etc, and has many useful features that the crates.io website lacks, including a pretty good full-text search.
“secure” is relative. They may not be e2e encrypted, but they are still encrypted via TLS, like any HTTPS traffic. It’s the same encryption used for online banking. If you care about your instance admin being able to read your messages, you should use Signal or a Matrix client though.
But remember that only a few years ago, almost nobody used e2e encryption, and it wasn’t much of an issue.
Whenever possible, it’s recommended to work in a common Git repository and use branching strategies to manage your work. However, if you do not have write access for the repository you want to contribute to, you can create a fork.
A fork is a personal copy of the repository and all its branches, which you create in a namespace of your choice. Make changes in your own fork and submit them through a merge request to the repository you don’t have access to.
https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html
How is this different from GitHub?
Just to make sure there’s no misunderstanding: When I want to contribute to a project I’m not involved in, like inkscape, I’m not allowed to create a branch in their repo, so I have to fork it, which creates a copy of the repo, and sets the original repo as a remote.
Note that git is a distributed VCS that doesn’t distinguish between servers and clients. Forking and cloning are the same operation from a technical perspective, except when you git clone
, the copy ends up on your local machine, and when you press the “fork” button, the copy is on a GitHub/GitLab server.
The name “pull request” is actually more accurate, because you ask the upstream repository to git pull
the changes from the downstream repo.
Thank you, too!
Even if this was true in 2013, when this article was written, the more accurate answer today would be “it depends”.
In Rust, there are multi-threaded async executors implementing M:N threading (e.g. tokio), where M asynchronous tasks are mapped to N operating system threads. So when you await
, the rest of the function may very well run in a different OS thread.
Swift also has async
/await
, and like tokio it uses multiple threads to run concurrent tasks in parallel (therefore using multiple OS threads).
Scala’s equivalent to asynchronous tasks are Promise
s, which can also run in parallel, as I understand it.
Kotlin doesn’t have async/await, but it has a similar concept, coroutines, which are basically a superset of asynchronous tasks. While Kotlin’s coroutines are single-threaded by default, there is a multi-threaded implementation, enabling truly parallel coroutines.
Go also uses coroutines (which it calls “goroutines”), which can use multiple threads.
C++ will soon get coroutines as well, which support multithreading to run coroutines in parallel.
That doesn’t solve the issue that there are too few contributors. Requiring a review doesn’t ensure that someone reviews the code.
On GitHub, everybody has the ability to review pull requests, even you. But there still aren’t enough volunteers who review PRs.
Discriminant is irrelevant and you’re not supposed to fuck with it
It matters because the conversion between i32 and the Result is only “free” if they have the same layout (which they do not, because of the discriminant). So a more costly conversion method is required.
And there is zero reason to use unsafe/transmute for this.
You are right, because the compiler is able to optimize your code quite well. However, if that optimization were to break at some point (as there is no guarantee that an optimization will continue to work in the future), it would become less efficient.
Thanks!
Piping in a shell script should be doable, it just hasn’t been requested yet.