Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Please don't generate structs with private fields #25

Open
Blei opened this issue May 22, 2016 · 4 comments
Open

Please don't generate structs with private fields #25

Blei opened this issue May 22, 2016 · 4 comments

Comments

@Blei
Copy link

Blei commented May 22, 2016

It doesn't make sense that a low-level C binding library would have structs with private fields. At least in cases where there is no accessible constructor; an example that I'm running into is GSourceFuncs.

@gkoz
Copy link
Member

gkoz commented May 22, 2016

So far we've been making private fields which are explicitly marked as private upstream (GSourceFuncs). This does cause problems in various places so I'm considering relaxing this rule. I'm reluctant to simply publish all fields though.

@antoyo
Copy link
Member

antoyo commented Oct 10, 2016

An example that I think needs to have a public field is Volatile.
Currently, it seems impossible to create a Volatile to set the ref_count to -1.
Could you please change to definition to:

pub struct Volatile<T>(pub T);

Thanks.

@antoyo
Copy link
Member

antoyo commented Oct 15, 2016

@gkoz @EPashkin @GuillaumeGomez I use Volatile multiple times in my gdbus crate as you can see here.
Could you please change the definition?
Or is there another way to achieve what I want.
Thanks.

@gkoz
Copy link
Member

gkoz commented Oct 25, 2016

@antoyo Volatile had been impossible to implement for a while but now that there's a volatile crate we can probably use it.

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

No branches or pull requests

3 participants