Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
shepmaster
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
7 ms
·
31.
▲
by
shepmaster
2y ago
When presented with a bug from the field, I also care about finding the path through my code where it occurred, but rarely do I need to know that `foo` called `foo_with_caching` called `foo_with_caching_recursive`. When reading a backtrace,
32.
▲
by
shepmaster
2y ago
I don't think you need a lint. When you define the error type returned by `handle_request`, you decide how the error type returned by `handle_request` will be incorporated. If you've decided to implement `From` then you've de
33.
▲
by
shepmaster
2y ago
Without deeply looking into it, I'd expect that to integrate with SNAFU, you could basically write something like this: struct SpanTraceWrapper(tracing_error::SpanTrace); impl snafu::GenerateImplicitData for SpanTraceWra
34.
▲
by
shepmaster
2y ago
SNAFU follows much the same idea: we have an attribute you can add [0] when you want to allow directly implementing `From`. Like thiserror, you can also mark an error as transparent [1] when even the error existing doesn't provide usef
35.
▲
by
shepmaster
2y ago
> pushing humans a little more to care about errors This is 100% a reason that I like using SNAFU. The term I use for this is a "semantic stack trace" — a lot of the time, the person experiencing the error doesn't care tha
36.
▲
by
shepmaster
2y ago
It can't be used as a literal build dependency [0], no. However, the fact that your crates uses SNAFU should [1] be completely hidden from your users. From the outside, you just return a regular enum or struct as your error type. If yo
37.
▲
by
shepmaster
2y ago
Hey all, I’m the author of SNAFU (mentioned in the article). I’m off to bed now, but I’d be happy to try and answer any questions people might have sometime tomorrow. I’m glad to see SNAFU was useful to others!
38.
▲
by
shepmaster
2y ago
See my sibling comment [1] for my current fun bug hunt. Overall, it's all pretty stable until I (try to) make it do new things. [1]: https://news.ycombinator.com/item?id=41931288
39.
▲
by
shepmaster
2y ago
> How many users does it serve? I don't really track users, but over the last 24 hours, there were 47.8k meaningful [1] requests taking a total of 28.2 hours. That ~0.5 requests per second number has been relatively consistent. >
40.
▲
by
shepmaster
2y ago
> the Rust Playground lets you run a hundred threads It's more that we don't do anything to prevent it, other than coarse process-wide memory / CPU time limits. IIRC, Rust-spawned threads on Linux use 2MiB of stack space b
41.
▲
by
shepmaster
2y ago
Code-wise, it's not too painful [1], the problem is that you need to enable more features for syn. By default, syn doesn't compile in support for parsing arbitrary types / expressions, which does increase the time / spac
42.
▲
by
shepmaster
2y ago
In case the author of the article is reading... > This is because Rust’s attribute grammar can’t support a callable here. The grammar of attributes supports it fine, it's just that Serde chooses to not use it. I'm not sure if i
43.
▲
by
shepmaster
2y ago
I think you are asking for this config [0] (let me know if not, maybe provide an example), but I’d caution against renaming it back to “Error”. The context selectors are not themselves errors, they are more-or-less fancy error constructor
44.
▲
by
shepmaster
2y ago
I don’t know the dbus crate, so I’m not trying to say anything about that crate’s usage, I’m simply saying that referencing after dereferencing is idiomatic Rust. For example, the standard library `String` type dereferences to `str` which y
45.
▲
by
shepmaster
2y ago
I partially agree. I have been experimenting with creating a lot of small error types (e.g. one per function) because of the benefit of narrowing down the set of possible causes. I also dislike crate-wide errors for the same reason. Howev
46.
▲
by
shepmaster
2y ago
Yes, `&*foo` is meaningful. For example, `Vec<T>` becomes `[T]` and then `&[T]`. Yes, a `Box<dyn Error>` is about the most rudimentary way of returning an arbitrary error, but it’s better than a panic or a sentinel value
47.
▲
by
shepmaster
2y ago
Do note that the standard library has stabilized backtraces now, so you only need that if you are targeting an older version of Rust. https://doc.rust-lang.org/std/backtrace/struct.Backtrace.htm...
48.
▲
by
shepmaster
2y ago
The biggest thing to me is that many people lump errors by type (“all IO errors are equivalent”) which is very wrong to me. SNAFU encourages and streamlines bucketing your errors into detailed chunks. Along the way, it makes adding details
49.
▲
by
shepmaster
2y ago
For that haven’t seen it, I’ll drop in my library SNAFU https://docs.rs/snafu/latest/snafu/
50.
▲
by
shepmaster
2y ago
I hope Grandma has some analytics hooked up to see all the traffic coming in! A small bug report: the "Share score" button on macOS Safari doesn't offer "copy" as an option for some reason. The same functionality on
51.
▲
by
shepmaster
2y ago
>> I often want to make public API changes to a library I maintain > They have such a tool, its called crater There are tools out in the wild that help crate authors do similar things. For example, I wrote my own[0] to evaluate som
52.
▲
by
shepmaster
2y ago
(Rust playground maintainer here) Incidentally, I also updated the Rust playground today. My usual process is to update everything [0] that is SemVer compatible and then one-by-one update packages with SemVer incompatible version bumps. Dur
53.
▲
by
shepmaster
2y ago
Many recipes for Vitamix peanut butter also mention mixing in some ice cream or something similar once you’ve scraped out as much peanut butter as you can. Then you get a little peanut butter smoothie as a treat at the end and help get out
54.
▲
by
shepmaster
2y ago
That’s what I came here to ask. When I make peanut butter in the Vitamix, I roast the peanuts and then blend them. I’ve never experienced separation, although I do store it in the refrigerator. What’s so different about this way of making p
55.
▲
by
shepmaster
2y ago
A year and a half doesn't seem like bad turnaround time to me. shrug On June 27, 2016, Microsoft announced a collaboration with Red Hat and Codenvy to standardize [Language Server Protocol]'s specification — https:
56.
▲
by
shepmaster
3y ago
Standalone installers for Rust: https://forge.rust-lang.org/infra/other-installation-methods...
57.
▲
by
shepmaster
3y ago
What is the upgrade path for a Llamafile? Based on my quick reading and fuzzy understanding, it smushes llama.cpp (smallish, updated frequently) and the model weights (large, updated infrequently) into a single thing. Is it expected that I
58.
▲
by
shepmaster
3y ago
Rust libraries like my [SNAFU] allow you to both add additional details and use the `?` operator: read_to_string(path).context(ConfigFileSnafu { path })?; [SNAFU]: https://docs.rs/snafu/latest/snafu/
59.
▲
by
shepmaster
3y ago
> Its not using the whole orchestrator...thing For further context, the "orchestrator" is a reimplementation of some of the backend. The original version of the playground basically took the user input, dumped it into a file, t
60.
▲
by
shepmaster
3y ago
I think that yes, it's technically possible with a good amount of work at all layers of the stack. The bigger worry I'd have is purely about time. The Docker images for the Rust playground clock in close to 2 GiB, and there's
More ›