> Any way to prevent this, so that only I am allowed to create FieldDef
> structs but can still return references to them in my public API?

You'll want something like:

pub struct FieldDef {
    priv field: int,
}

That way everyone can name your struct, but no one other than you can
construct it because it has private fields.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to