specta
rust-delegate
specta | rust-delegate | |
---|---|---|
1 | 8 | |
203 | 422 | |
- | - | |
8.8 | 6.7 | |
7 days ago | 5 months ago | |
Rust | Rust | |
MIT License | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
specta
-
Using rust to generate typescript client
I assume you're using Axum or Actix as your router & web server, in which case I think using OpenAPI specs is your best option. I see that rspc has already been mentioned in this thread, which I would definitely recommend (disclaimer - I work at the company that builds it) if continuing to use REST wasn't a priority, since it can auto-generate all the TS bindings you need and has a React Query integration so you'd feel right at home. It's able to do so much since it's able to sit between your backend and frontend code, but REST is a lot less opinionated, hence the recommendation to continue using OpenAPI. However, if you're willing to lose some type-safety there's the option of using a Rust -> TS generator specifically for your data types, and then manually use React Query. You'd lose the type-level enforcement of your routes, but at least you'd have your structs and enums available in TS. If you were to take this route I'd personally recommend using Specta, since it's the Rust -> TS generator that powers rspc, but there's also ts-rs and Typeshare which could probably do the job (though I don't think they're as good).
rust-delegate
-
On inheritance and why it's good Rust doesn't have it
Ah, that answers the first question, as to how inheritance is superior to manual delegation. By the way, this crate seems to do a good job of supporting delegation: https://crates.io/crates/delegate. I have nothing against this in principle.
-
Fellow Rust enthusiasts: What "sucks" about Rust?
This is certainly one that's bugged me too. There's the delegate crate which helps, but is still a decent amount of boilerplate due to macro limitations
- Enum variants share Trait while Parent does not - A Better solution?
-
Hey Rustaceans! Got a question? Ask here! (44/2022)!
As u/onomatopeiaddx said, it isn't possible since macros only have access to the token tree it is given. I don't see why a newtype wouldn't work tho. and to help with newtypes you may want to have a look at the delegate crate
-
The Rust RFC process does not seem as amazing as I initially thought
Macros, probably. For example this one, that was already made by someone else, published on crates.io and is actively maintained. If the feature is already possible in rust, but requires a lot of boilerplate, then macros are the answer 99% of the time.
-
Inheritance to composition
delegate crate would reduce some boilerplate.
- Is there a way to append to struct in Rust?
What are some alternatives?
Rust-Struct-Reification - A macro to reify structs and their fields for type-safe runtime invocation and reflective access to fields and attributes
born - Remove code duplication from Struct and Enum with functional macros.
deno - A modern runtime for JavaScript and TypeScript.
dislike-in-rust - A list of the few things I don't like about rust
typeshare - Generate code in different languages from Rust type definitions for FFI interop.
pollster - A minimal async executor that lets you block on a future
default-args.rs - zero runtime cost default arguments in rust
getrandom - A small cross-platform library for retrieving random data from (operating) system source
compiler-team - A home for compiler team planning documents, meeting minutes, and other such things.
SHLL - An experiment of high level code optimization
askama - Type-safe, compiled Jinja-like templates for Rust
rust-orphan-rules - An unofficial, experimental place for documenting and gathering feedback on the design problems around Rust's orphan rules