Function attrs [src]
Prototype
pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attributes
Parameters
self: *Builder
attributes: []Attribute.Index
Source
pub fn attrs(self: *Builder, attributes: []Attribute.Index) Allocator.Error!Attributes {
std.sort.heap(Attribute.Index, attributes, self, struct {
pub fn lessThan(builder: *const Builder, lhs: Attribute.Index, rhs: Attribute.Index) bool {
const lhs_kind = lhs.getKind(builder);
const rhs_kind = rhs.getKind(builder);
assert(lhs_kind != rhs_kind);
return @intFromEnum(lhs_kind) < @intFromEnum(rhs_kind);
}
}.lessThan);
return @enumFromInt(try self.attrGeneric(@ptrCast(attributes)));
}