rust-cli / rust-cli/config-rs

[feature request] zero cost, zero sized default config types?

Open
#229 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
3.2k
Forks
265
Avg merge
2h 42m
Merged PRs (30d)
4

Description

I'm not sure whether this is compatible with the way you do things, but I've found myself in need of zero cost config types in the course of making somewhat complex data structures, there are lots of little variables that need to be tweaked and tuned and experimented with at runtime, but ultimately will end up being constant in most applications. It turns out that Rust can support that really elegantly with zero-sized types: https://github.com/makoConstruct/vec-with-gaps/blob/main/src/lib.rs#L243 and the stdlib has started doing a similar thing with allocators.

I'm thinking about writing codegen for doing these, so I went looking to see if anyone else was already doing it. It doesn't seem like you're doing that kind of thing? (with the Loosely Typed stuff?) But I thought I should ask you, in case there's some route to compatability I can't see or in case you know of another project doing something closer to this.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no config-rs files or tests; it points instead to src/lib.rs around line 243 in vec-with-gaps and mentions existing “Loosely Typed” support. Start by reviewing that support and the linked Rust zero-sized-type example. The desired API, implementation scope, and completion criteria still need agreement before work can be considered done.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.