![](/static/253f0d9b/assets/icons/icon-96x96.png)
![](https://lemmy.magnor.ovh/api/v3/image_proxy?url=https%3A%2F%2Fprogramming.dev%2Fpictrs%2Fimage%2F1f7e5534-88d3-4d6f-bc57-7cda9553890f.webp)
- Don’t use
"*"
dep version requirements. - Add
Cargo.lock
to version control. - Why read to string if you’re going to base64-encode and use
Vec<u8>
later anyway?
"*"
dep version requirements.Cargo.lock
to version control.Vec<u8>
later anyway?Here is an originally random list (using cargo tree --prefix=depth
) with some very loose logical grouping. Wide-scoped and well-known crates removed (some remaining are probably still known by most).
mime data-encoding percent-encoding textwrap unescape unicode-width scraper
arrayvec bimap bstr enum-iterator os_str_bytes pretty_assertions paste
clap_complete console indicatif shlex
lz4_flex mpeg2ts roxmltree speedy
aes base64 hex cbc sha1 sha2 rsa
reverse_geocoder trust-dns-resolver
signal-hook signal-hook-tokio
blocking
fs2
semver
snmalloc-rs
My quick notes which are tailored to beginners:
Option::ok_or_else()
and Result::map_err()
instead of let .. else
.let .. else
didn’t always exist. And you might find that some old timers are slightly triggered by it.Option
s as iterators (yes Option
s are iterators).?
operator and the Try
traitlet headers: HashMap = header_pairs
.iter()
.map(|line| line.split_once(":").unwrap())
.map(|(k, v)| (k.trim().to_string(), v.trim().to_string()))
.collect();
(Borken sanitization will probably butcher this code, good thing the problem will be gone in Lemmy 0.19)
Three tips here:
headers
will be returned as a struct field, the type of which is already known.collect()
itself. That may prove useful in other scenarios.Result
/Option
if the iterator items are Result
s/Option
s. So that .unwrap()
is not an ergonomic necessity 😉.into()
or .to_owned()
for &str => String
conversions.
http
crate is the compatibility layer used HTTP rust implementations. Check it out and maybe incorporate it into your
experimental/educational code.Alright, I will stop myself here.
Broken input sanitization probably.
Issue will thankfully no longer exist in the next lemmy release.
Defederation questions/requests should be made in private, at least initially. That is to avoid turning an instance, which may temporarily not be actively administered/moderated, into a hotbed of illegal posting.
As it stands, any concern troll can turn a random small instance, which may not have an admin around for two days or three, into a hotbed of illegal or potentially-illegal activity, simply by bringing attention to it with a public defederation request.
Even with the presumption of genuine concern, the effect and end result will be the same.
Not a good move. That instance had almost no content before the defederation trolls gave it publicity. You just made the age old mistake of feeding the trolls. And they will come back for more, and more, and more…
Sort by “best” is coming to Lemmy, in case you didn’t know.
The codec is basic, uses decades-old tech, and was trivially REed.
Lemmy instance choice does not check out ;)
and for testing you get a wackload of SBCs and Bluetooth chips and test that
I asked because I wasn’t aware of any consumer buds supporting Opus. I wasn’t aware of PineBuds, thank you for mentioning them.
keep in mind that it’s hard to get real numbers on LDAC because decoding is proprietary
I used to think the same. But as it turns out, a decoder exists. Maybe some people don’t want anyone to know about it to keep the myths alive ;)
EDIT: Also, as a golden rule, whenever anyone sees the words High-Res in an audio context, they should immediately realize that they are being bullshitted.
After testing LC3Plus, Opus, and AAC personally for bluetooth, LDAC claims are BS
How did you test Opus for bluetooth?
latency is significantly better then AAC (tested against libfdk) and marginally better then opus
In case you didn’t know, you can use 10ms (or even 5ms) frames with Opus instead of the default (20ms). 10ms should roughly match LC3plus’s default latency while still retaining high quality.
I only use(d) it in a specific way. For example searching for a sport club (non-dictionary) name, limiting the search to that sport’s sub, and sorting by new).
For general search, a search engine would indeed probably work much better.
Problem found and solved according to Reddit Status btw, and confirmed by my own tests.
When have you ever found anything you were looking for with it?
Always.
I’m not talking about inherent brokenness that was always there.
There is a specific search with a non-dictionary word, and limited to specific sub, that always worked, but it’s not working right now, returning zero results. Reddit search is fully broken right now (except for finding sub names if you don’t limit the search to a sub).
Problem is still persisting btw. And Reddit Status still reporting no problems.
LDAC claims are completely bullshit.
LC3plus is worse than AAC quality wise (to be expected). Lower latency is the only thing going for it. And that’s just because AAC is a very high-latency codec. Opus (as a format) would win on both fronts, although there could be issues with creating a high-quality encoder for it that is not too complex, and power-efficient.
Search is broken in Reddit right now (for me at least). Best part is, it doesn’t always report an error, just pretends there are no results.
Oh, and Reddit Status doesn’t know yet.
Regarding
Cargo.lock
, the recommendation always was to include it in version control for application/binary crates, but not library ones. But tendencies changed over time to include it even for libraries. If arust-toolchain
file is tracked by version control, and is pinned to a specific stable release, thenCargo.lock
should definitely be tracked too [1][2].It’s strictly more information tracked, so there is no logical reason not to include it. There was this concern about people not being aware of
--locked
not being the default behaviour ofcargo install
, giving a false sense of security/reliability/reproducibility. But “false sense” is never a good technical argument in my book.Anyway, your crate is an application/binary one. And if you were to not change the
"*"
dependency version requirement, then it is almost guaranteed that building your crate will break in the future without trackingCargo.lock
;)