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 library itself.

AlignedSlice

Returns a slice with the given new alignment, all other pointer attributes copied from AttributeSource.

mem.AlignedSlice
fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) type

File

lib/std/mem.zig:4963

Code

fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) type {
    const ptr = @typeInfo(AttributeSource).pointer;
    var attrs = ptr.attrs;
    attrs.@"align" = new_alignment;
    return @Pointer(.slice, attrs, ptr.child, null);
}