graphql-rust / juniper

GraphQL server library for Rust
Other
5.7k stars 421 forks source link

Support no_std targets #1087

Open bootstrap-prime opened 2 years ago

bootstrap-prime commented 2 years ago

Is your feature request related to a problem? Please describe. I'm developing on an embedded bare metal target, and something I've wanted for a while is a self-describing protocol with introspection. A UI app could use it to autogenerate a UI, and significantly reduce the maintenance burden around configuration of various gadgets. GraphQL seems like a great fit, with it's introspection and transport-agnosticism. A gadget could have a graphql server available over a bluetooth or usb serial transport, and you could interact with that and set/get variables. GraphQL doesn't technically have a dependency on js or other web tech, and so it could be used bare-metal. However, Juniper does not currently support no_std targets.

Describe the solution you'd like It would be nice if juniper supported a minimal implementation (single client, no async, no alloc if possible) on no_std targets.

tyranron commented 2 years ago

@bootstrap-prime does no_std here implies no alloc? If so, that's not possible, unfortunately. Not until Rust lands real async traits. We do quite a lot of boxing inside the machinery, mostly because of traits doesn't support async, but also for some other concerns too.

tyranron commented 2 years ago

Maybe, only the sync resolution may clink. But this still should be investigated.

bootstrap-prime commented 2 years ago

It would be nice if no_std no-alloc were possible, but it isn't necessarily required. bare-metal targets can bring their own allocator to be alloc and no_std.