Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • rust
  • kernel
  • init.rs
Find file BlameHistoryPermalink
  • Benno Lossin's avatar
    rust: init: add `..Zeroable::zeroed()` syntax for zeroing all missing fields · 35e7fca2
    Benno Lossin authored Aug 14, 2023
    
    
    Add the struct update syntax to the init macros, but only for
    `..Zeroable::zeroed()`. Adding this at the end of the struct initializer
    allows one to omit fields from the initializer, these fields will be
    initialized with 0x00 set to every byte. Only types that implement the
    `Zeroable` trait can utilize this.
    
    Suggested-by: default avatarAsahi Lina <lina@asahilina.net>
    Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
    Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
    Reviewed-by: default avatarGary Guo <gary@garyguo.net>
    Signed-off-by: default avatarBenno Lossin <benno.lossin@proton.me>
    Link: https://lore.kernel.org/r/20230814084602.25699-8-benno.lossin@proton.me
    
    
    [ Rebased on `rust-next` and cleaned a few trivial nits. ]
    Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
    35e7fca2
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7