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

Group parsing #4

Merged
merged 5 commits into from
Sep 1, 2024
Merged

Group parsing #4

merged 5 commits into from
Sep 1, 2024

Conversation

InnocentZero
Copy link
Collaborator

Adds TOML parsing. Some backend traits need changes to make them TOML compatible. Else we'd need to change the group file description language.

@InnocentZero InnocentZero requested a review from ripytide August 31, 2024 20:34
@InnocentZero InnocentZero marked this pull request as draft August 31, 2024 20:34
@InnocentZero
Copy link
Collaborator Author

InnocentZero commented Aug 31, 2024

In particular, unit type () doesn't work. It has been used in a lot of places so we either need to find alternatives for backend types or find a different config file format.

src/groups.rs Outdated Show resolved Hide resolved
@ripytide
Copy link
Owner

ripytide commented Aug 31, 2024

I think the best option so we don't have to throw away the strongly typed backend associated trait types might be to write a bit of custom serialization/deserialization logic so that something like this gets mapped into the BTreeMaps inside PackagesInstall:

arch = [
"pacdef-bin",
{ package="neovim", clean_install = true },
]

@ripytide
Copy link
Owner

ripytide commented Aug 31, 2024

Semantically this is roughly equivalent to a BTreeSet<struct { package: String, clean_install: Option<bool>,} but then we lose the uniqueness guarantee from the BTreeMap

@ripytide
Copy link
Owner

I rebased the PR after #3 was merged

@ripytide
Copy link
Owner

ripytide commented Aug 31, 2024

I think we might need to finalize our ideal file format first in #5 and then implementing it will probably be best via a custom parsing function that builds a struct from a generic toml::Table type without serde due to the difficulties with getting serde to serialize/deserialize exactly the way we want.

Adds TOML parsing for group files. Some of the
backend trait types for various backends need to
be modified for TOML compatibility.

Signed-off-by: innocentzero <[email protected]>
Signed-off-by: innocentzero <[email protected]>
@ripytide ripytide marked this pull request as ready for review September 1, 2024 16:03
@ripytide
Copy link
Owner

ripytide commented Sep 1, 2024

The PR looks good, I'm going to merge this so I can take a shot at implementing the file format from #5 in another PR

@ripytide ripytide merged commit e217f5b into ripytide:main Sep 1, 2024
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