skinsuit

utility macros mostly for object variants

Pure Nim score 15/100 · tests present · no docs generated

Summary

Latest Version Unknown
License MIT
CI Status Failing
Downloads 0
Last Indexed 2026-07-21 05:25

Installation

nimble install skinsuit
choosenim install skinsuit
git clone https://github.com/metagn/skinsuit

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
skinsuit - - - - - - -

Source

Repository https://github.com/metagn/skinsuit
Homepage https://github.com/metagn/skinsuit
Registry Source nimble_official

README

skinsuit

Utility macros mostly for object variants

import skinsuit

type Value {.sum, equals.} = object 
  case kind: _
  of None: discard
  of Integer, Boolean:
    _: int
  of Unsigned:
    _: uint
  of Float:
    _: float

# == for case objects generated by equals
assert Value(kind: Integer, integer: 1) == Integer(1)
assert Value(kind: Boolean, integer: 1) == Boolean(1)
assert Value(kind: Unsigned, unsigned: 1) == Unsigned(1)
assert Value(kind: Float, float: 1) == Float(1)

proc double[T](x: var T) =
  x *= 2
proc double(x: ValueNone) = discard
proc double(v: var Value) {.dispatchCase: v.}
var v = Integer(1)
double(v)
assert v == Integer(2)
v = Float(1.0)
double(v)
assert v == Float(2.0)

# see tests/docs for other macros