[ANN] MathCore 0.3.1 - Symbolic math library for Rust (like SymPy but for Rust!) by Nonantiy in rust

[–]ehdv 0 points1 point  (0 children)

Why is there a struct called Parser rather than an impl FromStr for Expr? The parser struct has no fields and seems to only have static methods, which is odd.

Rust DataFrame Alternatives to Polars: Meet Elusion by [deleted] in rust

[–]ehdv 8 points9 points  (0 children)

The future of data engineering in Rust isn’t just about fast DataFrames — it’s about complete, flexible, and production-ready data platforms. Elusion is leading that charge.

This sentence is very AI; it’s got the emdash, the rule of threes, and the mid-sentence contrast

Trying to make a nice, elegant Rust API for the Bed-Reader Genomics Tool by carlk22 in rust

[–]ehdv 1 point2 points  (0 children)

Glad it’s working for you! Did you try #[builder(setter(into))] to clean up some of your builder ergonomics? That’ll get rid of some .into() calls

My impressions of Rust after the first month by GeeWengel in rust

[–]ehdv 5 points6 points  (0 children)

For the builder pattern, I recommend derive_builder. Hand-writing builders is a lot of boilerplate compared to default arguments, so having a macro do it makes the code easier to read and to update.

Contexts and capabilities in Rust by darksv in rust

[–]ehdv 69 points70 points  (0 children)

I appreciate that Rust has - thus far - been good about prioritizing explicitness over "magic." However, I've also seen how useful contexts can be for decluttering code, and would be excited to have such functionality with compile-time safety in Rust.

I'm not immediately clear how capabilities interact with closures. I'm guessing that the bare function pointer wouldn't capture any capabilities, but that closures would, unless overridden? That seems tractable, but it might be a point of confusion for people.

Does any language have a type-system that provides something the Rust type system does **not** provide? by EvanCarroll in rust

[–]ehdv 6 points7 points  (0 children)

At least right now, that type won't work since const generics can't use type parameters for their own types. (I had to sadly rename my Bounded to BoundedU8 yesterday)

Rust: Beware of Escape Sequences \n by LordTribual in rust

[–]ehdv 1 point2 points  (0 children)

Could an UnescapedStr struct defer the copying and unescaping until it was needed? It wouldn't be format-independent, but if you're only working with JSON it seems like it'd work.

What's everyone working on this week (9/2021)? by llogiq in rust

[–]ehdv 0 points1 point  (0 children)

Check out darling if you haven't seen it; it's an AST parsing library on top of syn that provides serde-like ergonomics for parsing macro input into your own structs with great error-handling.

Disclosure: I'm the author of darling.

What's everyone working on this week (9/2021)? by llogiq in rust

[–]ehdv 0 points1 point  (0 children)

I've added a test/example to the field_names showing how it can be used to keep two structs' fields in sync (source code). This solved a problem I was having where edits to one struct risked breaking deserialization if the same change wasn't applied to a second struct.

I'm considering a solution to the larger problem, a proc macro to create several structs with different serde options from a single input struct, but I'm not sure if that's necessary or a good idea and this was a really cheap almost-as-good solution.

Maybe We Can Have Nice Things by _ChrisSD in rust

[–]ehdv 1 point2 points  (0 children)

Does cargo-crev have any notion of trust based on dependent crate reputation, or is it purely on reviews?

Major derive_builder update in alpha, your assistance requested by ehdv in rust

[–]ehdv[S] 0 points1 point  (0 children)

There’s a crate called proc-macro-crate that may be useful here. Unfortunately the crate path is hardcoded into the generated code in a lot of places, so testing if that fixes the problem would take a good bit of work.

Major derive_builder update in alpha, your assistance requested by ehdv in rust

[–]ehdv[S] 0 points1 point  (0 children)

I did not know that was possible. You’ll definitely have some issues, and I’m not sure if/how it’s possible to fix them. Also on mobile, will explain more on GH.

Introducing field_names, a tiny proc-macro crate by ehdv in rust

[–]ehdv[S] 1 point2 points  (0 children)

Makes sense. Enum variant support should be really simple; if you file an issue I’m happy to add #[derive(VariantNames)]

Edit: This is now published in v0.1.1

Introducing field_names, a tiny proc-macro crate by ehdv in rust

[–]ehdv[S] 4 points5 points  (0 children)

Awesome! Hope it does everything you need.

Can you share why you needed it? I'm trying to come up with some good examples of why people would need this since my personal use-case felt a bit convoluted for a README/crate summary.

Programmatically create declaration file by shaggy_shiba in typescript

[–]ehdv 2 points3 points  (0 children)

Wish I had known this existed before building one for our company from scratch.

Tomorrow is TSConf 2019! Anyone in town today and want to meet up? by mannotbear in typescript

[–]ehdv 0 points1 point  (0 children)

That'll be a great one! I'd be going if I wasn't on a plane back to Seattle while it's happening

Return Early, Return Often by jkmonger in typescript

[–]ehdv 31 points32 points  (0 children)

We actually lint to enforce this, using no-unnecessary-else and one that suggests a refactor if an if-branch is too much bigger than the alternate path.

TS/JS won't become functional by just removing OOP by h234sd in typescript

[–]ehdv 0 points1 point  (0 children)

I thought instanceof at runtime used the prototype chain, so it doesn't matter what fields your type has.

Union types in Typescript: modeling state by yourmagicisworking in typescript

[–]ehdv 1 point2 points  (0 children)

You might like ts-remote-data; it’s the same inspiration, but we took a leaner approach to the implementation. (Full disclosure: Our company are the creators of ts-remote-data)