Zig 0.17.0-dev (Split by item) This is an example of documentation generated by
ZigDoc , an alternative to Zig's built-in
Auto Doc feature. See also
examples in other modes/formats . The project being documented here (as the example) is the Zig standard library.
std › heap › SafeAllocator › FuzzMultiThreadedContext › ThreadOps › Op Private Union Op Doc Source Private Union std.heap.SafeAllocator.FuzzMultiThreadedContext.ThreadOps.Op
const Op = union (fuzz_probs .Op ) Fields alloc : struct { len : usize , alignment : Alignment , splat : ?u8 , /// Not embeded directly in the struct as a workaround for tsan since a /// switch directly on `Op` loads the entire value non-atomically. result : *MemoryDependency , } free : struct { memory : *MemoryDependency , alignment : Alignment , splat : ?u8 , } resize : Realloc remap : Realloc Structs File heap/SafeAllocator.zig: 1823
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868 const Op = union (fuzz_probs .Op ) {
alloc : struct {
len : usize ,
alignment : Alignment ,
splat : ?u8 ,
/// Not embeded directly in the struct as a workaround for tsan since a
/// switch directly on `Op` loads the entire value non-atomically.
result : *MemoryDependency ,
},
free : struct {
memory : *MemoryDependency ,
alignment : Alignment ,
splat : ?u8 ,
},
resize : Realloc ,
remap : Realloc ,
const Realloc = struct {
memory : *MemoryDependency ,
alignment : Alignment ,
new_len : usize ,
splat : ?u8 ,
/// Not embeded directly in the struct as a workaround for tsan since a
/// switch directly on `Op` loads the entire value non-atomically.
result : *MemoryDependency ,
};
const MemoryDependency = struct {
ready : std .Io .Event ,
/// Null if the memory failed to be allocated
memory : ?[]u8 ,
const init : MemoryDependency = .{
.ready = .unset ,
.memory = undefined ,
};
fn get (dep : *MemoryDependency , io : std .Io ) ?[]u8 {
dep .ready .waitUncancelable (io );
return dep .memory ;
}
};
}