Skip to content

DutchGhost/maybeuninit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

maybeuninit

License:EUPL Zig

This is a userlevel implementation of the undefined keyword in Zig.
It is inspired by MaybeUninit in Rust.

Minimum supported Zig

master

Each day will be tested in CI whether this project still builds on Zig master.

Recent changes

  • 0.6.1
    • Add withByte as initializer function.
    • Remove all use of inline, as the usage of inline was considered wrong.
  • 0.6
    • Rename assume_init to assumeInit.
    • rename as_ptr and as_mut_ptr to asPtr and asMutPtr.
    • rename first_ptr and first_ptr_mut to firstPtr and firstPtrMut.
  • 0.5.2
    • Only support Zig's Master branch.
  • 0.5.1
  • 0.5
    • Do not call @memset in MaybeUninit(T).zeroed() if T has a size of 0.
  • 0.4
  • 0.3
    • Change the return type of first_ptr_mut from *Self to *T.
    • Adds a test that calls first_ptr_mut on an empty slice.
  • 0.2
    • Change the definition of MaybeUninit from packed union to extern union, due to packed union's setting the alignment always to 1.
  • 0.1
    • Initial library setup.

Issues

At the point of writing, it is impossible to create an uninitialized MaybeUninit(T), and later initialize it at compiletime.
This is an issue of the compiler, which tracks the current active field of packed and extern unions when used at compiletime, while it shouldn't.
The issue is reported to the Zig compiler, and can be followed here.

About

MaybeUninit in Zig.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages