Skip to documentation
SLOP

tiny.preserves.assertIsDomain

Reference tiny.preserves assertIsDomain

Defined in domain.

Stops compilation unless D declares public functions named eql, order, deinit and clone.

Called byCallsNo direct callstest sourcelib.preserves.src.domaintest: NoEmbedded satisfies the Domain...domainassertIsDomain
Static calls · unresolved targets: 0 · external targets: 0.

Source

Source: lib/preserves/src/domain.zig:32

zig
/// Stops compilation unless `D` declares public functions named `eql`, `order`, `deinit` and/// `clone`. Code that writes a generic over `Value` calls it first, as `Value` and every generic of/// the package do, so a type of embedded values that breaks the rules fails. The check tests that/// the names exist and reads no signature. The error names the missing function and the signature/// the package calls: `eql(a: Self, b: Self) bool`, `order(a: Self, b: Self) std.math.Order`,/// `deinit(self: *Self, allocator: Allocator) void` and/// `clone(self: Self, allocator: Allocator) !Self`.pub fn assertIsDomain(comptime D: type) void {    if (!@hasDecl(D, "eql")) {        @compileError("Domain " ++ @typeName(D) ++ " is missing `pub fn eql(a: Self, b: Self) bool`");    }    if (!@hasDecl(D, "order")) {        @compileError("Domain " ++ @typeName(D) ++ " is missing `pub fn order(a: Self, b: Self) std.math.Order`");    }    if (!@hasDecl(D, "deinit")) {        @compileError("Domain " ++ @typeName(D) ++ " is missing `pub fn deinit(self: *Self, allocator: Allocator) void`");    }    if (!@hasDecl(D, "clone")) {        @compileError("Domain " ++ @typeName(D) ++ " is missing `pub fn clone(self: Self, allocator: Allocator) !Self`");    }}

Source: lib/preserves/src/root.zig:135

zig
pub const assertIsDomain = domain.assertIsDomain;

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433