Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Inner Workings

As it was mentioned in the Basics, fieldx rewrites structures with fxstruct applied. The following table reveals the final types of fields. T in the table represents the original field type, as specified by the user; O is the original struct type.

Info

The way a particular container type is chosen depends on the combination of the enabled feature flags. With regard to the async mode operation refer to the Async Mode of Operation chapter, Backend Choice section for more details. With regard to the choice between FXRwLock and RwLock see the More on Locks chapter.

Apparently, skipped fields retain their original type. Sure enough, if such a field is of non-Send or non-Sync type the entire struct would be missing these traits despite all the efforts from the fxstruct macro.

There is also a difference in how the initialization of lazy fields is implemented. For non-locked (simple) fields the lazy builder method is called directly from the accessor method. For locked fields, however, the lazy builder is invoked by the implementation of the proxy type.