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.
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.
Thank you, too!
My Fairphone is 4 years old, it has been dropped on the floor (even hard surfaces like rocks and asphalt) countless times. It still works and looks like new. It has a protective cover that covers the edges, but not the screen or the back. It still survived all these years without a scratch.
To be funny, a joke requires a grain of truth. Absurdity alone doesn’t make a good joke.
The majority of aircraft pilot fatalities occur in crashes of privately owned planes and helicopters rather than on regularly scheduled commercial jet aircraft.
https://www.ishn.com/articles/112748-top-25-most-dangerous-jobs-in-the-united-states
By the way, most deaths aren’t reported on the news.
It is so frustrating when a conspiracy narrative is mixed with valid criticism, which ultimately only taints the criticism by association with the “conspiracy.”
That doesn’t solve the issue that there are too few contributors. Requiring a review doesn’t ensure that someone reviews the code.
I guess it cannot be done if their IT infrastructure was not designed with that use case in mind. Although I’m not familiar with human resource management software, I don’t find this hard to believe at all.
Also, you’ll understand what Biron Tchaikovsky meant with “Please believe me” when you look at their email address. They already tried to do it, and probably complained many times before giving up.
Oh, didn’t the domain somesoftwarecorp.com
give it away?
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.
This is not possible, because Rust still stores a discriminant even when the enum values don’t overlap.
As far as I can tell, the only situation where Rust doesn’t store a discriminant is when either the Ok
or Err
variant is zero-sized, and the other variant has a niche. So, Result<(), ErrorEnum>
can be represented as an integer, but Result
can not.
You can still use enums, and implement simple conversions like this:
#[repr(i8)]
pub enum Error {
E1 = -1,
E2 = -2,
E3 = -3,
E4 = -4,
}
#[repr(i8)]
pub enum Success {
S0 = 0,
S1 = 1,
S2 = 2,
S3 = 3,
}
pub type LibResult = Result;
pub fn number_to_result(value: i32) -> Option {
match value {
-4 ..= -1 => Some(Err(unsafe { std::mem::transmute(value as i8) })),
0 ..= 3 => Some(Err(unsafe { std::mem::transmute(value as i8) })),
_ => return None,
}
}
pub fn result_to_number(res: LibResult) -> i32 {
match res {
Ok(value) => value as i32,
Err(error) => error as i32,
}
}
P.S. Sorry that the generics aren’t displayed due to Lemmy’s bad santiziation.
Iframes cannot access the main frame’s DOM if the iframe is from a different origin than the main frame, and they never share the same JavaScript execution context, so an iframe can’t access the main frame’s variables etc.
It’s not required that iframes run in a different process, but I think they do at least in Chrome and Firefox if they’re from a different origin. Also, iframes with the sandbox
attribute have a number of additional restrictions, which can be individually disabled when needed.
They still have their place; for example to embed Google Maps or a YouTube video. Generally, whenever you want to embed something from a different website you have no control over, that shouldn’t inherit your style sheets, and should be sandboxed to prevent cross site scripting attacks.
Thanks!
Piping in a shell script should be doable, it just hasn’t been requested yet.