Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ebauche: Comment avoir une jolie c-enum typesafe en Rust. #171

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

darnuria
Copy link
Contributor

@darnuria darnuria commented Jun 19, 2024

@GuillaumeGomez / @AureliaDolo au secours il y a trop de fautes.

EDIT: je fix le msg de la PR apres les premiers retours. :P

TODO

  • @GuillaumeGomez trouve ca cool
    • J'ajoute des exemples d'usage
    • Je montre un peu de code pour le cas Unknown

Copy link

@AureliaDolo AureliaDolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Juste des typos ✨

src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved
src/4_1.md Outdated Show resolved Hide resolved

Cependant avec cette approche notre type Qtype a cause du variant `Qtype::Unknown(u16)` aura une taille de
`4` bytes (un u32) au lieu de 2 bytes (u16)!
En effet les enums sont compilées actuellement en tagged-unions et il faut un peu de place pour le tag

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que tu peux faire le schéma qui montre la place prise par le tag ? vs ce que ça fait quand ya pas le unknown type dans l'enum ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants