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

Ini::iter always return general section even it's empty since 0.19 #119

Open
sorz opened this issue Jan 9, 2024 · 4 comments
Open

Ini::iter always return general section even it's empty since 0.19 #119

sorz opened this issue Jan 9, 2024 · 4 comments

Comments

@sorz
Copy link

sorz commented Jan 9, 2024

I'm not sure if this change is intended or introduced by accident (by #88 I guess).

0.18 and before: Ini::new().next() is None

0.19 and after: Ini::new().next() is Some((None, Properties { data: {} }))

(P.S I was iterating all sections from user-generated ini file and prohibited empty section. This change break the logic since now there is always a empty general section.)

sorz added a commit to sorz/moproxy that referenced this issue Jan 9, 2024
@zonyitoo
Copy link
Owner

zonyitoo commented Jan 9, 2024

Well, yes. It was added from #88 .

@zonyitoo
Copy link
Owner

zonyitoo commented Jan 9, 2024

Maybe we can add a Ini::new_empty() method to create a truely empty Ini?

@sorz
Copy link
Author

sorz commented Jan 9, 2024

It also affects, for example, Ini::load_from_file: a file consisting solely of named sections appears to have an empty general group in its iterator.

We might add a check in the iterator impl to not yield an empty general group?

@zonyitoo
Copy link
Owner

We might add a check in the iterator impl to not yield an empty general group?

It looks like a good solution that wouldn't break compatibility (maybe).

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

No branches or pull requests

2 participants