/*! This page describes how the TypeLevel macro deals with privacy. For an example of a type with private fields looks at [this chapter of the guide](../guide_10/index.html) # Enums Enum fields have the same privacy as the enum itself. Enums variants implicitly have the same privacy as the enum type itself. # Structs TypeLevel deals with pricacy on structs by : - Creating field accessors in `type_level::fields` with 2 levels of privacy: - The privacy of the struct type itself. - The privacy of the most public private field, even if the field was originally more private than that. - Hiding the associated types reoresenting fields more private than the struct , in the Trait and IntoRuntime traits.
Fields are hidden with #[doc(hidden)], and by prefixing `priv_` (in Trait) / `rt_priv_` (in Trait) to the associated type representing the field. - When there is at least one field more private that the struct: Adding the `__IsPriv` type parameter to the Const struct.
It is necessary that one provides a way to construct the struct if one wants to access the struct from outside the module that declared it. # Field name/Privacy table These are the tables of visibilities/names given to fields. 'Private' means more private than the type. 'ModPubPriv' means the most public of the private fields. 'Public' means as public as the type. ### Tupled Structs Tupled structs,ie:`struct What(u32,u32);` <field_position> means the position of the field,starting from 0.
<DerivingType>Trait <DerivingType>WithRuntime fields module Const<DerivingType>
private field name:priv_field_<field_position>
visibility: #[doc(hidden)]
name:rt_priv_field_<field_position>
visibility: #[doc(hidden)]
name:field_<field_position>
visibility:ModPubPriv
name:field_<field_position>
visibility:same visibility
public field name:field_<field_position>
visibility: visibility of <DerivingType>
name:rt_field_<field_position>
visibility: visibility of <DerivingType>
name:U<field_position> (a type-level integer ,ie:U0)
visibility:pub (because of the U* accessor)
name:<field_position>
visibility:same visibility
### Braced Structs Braced structs ie:`struct A{ field_name:u32 }`. <fieldname> is the name of the field.
<DerivingType>Trait <DerivingType>WithRuntime fields module Const<DerivingType>
private field name:priv_<fieldname>
visibility: #[doc(hidden)]
name:rt_priv_<fieldname>
visibility: #[doc(hidden)]
name:<fieldname>
visibility:ModPubPriv
name:<fieldname>
visibility:same visibility
public field name:<fieldname>
visibility: visibility of <DerivingType>
name:rt_<fieldname>
visibility: visibility of <DerivingType>
name:<fieldname>
visibility: visibility of <DerivingType>
name:<fieldname>
visibility:same visibility
*/