From 0c41ca324eaa6969ffb95dc0fab150347e021f8c Mon Sep 17 00:00:00 2001 From: metagn <10591326+metagn@users.noreply.github.com> Date: Fri, 14 Jul 2023 11:54:13 +0300 Subject: [PATCH] rename --- .github/workflows/main.yml | 2 +- README.md | 4 ++-- variantsugar.nimble => skinsuit.nimble | 4 ++-- src/skinsuit.nim | 2 ++ src/{variantsugar => skinsuit}/conditional.nim | 4 ++++ src/{variantsugar => skinsuit}/dispatch.nim | 0 src/{variantsugar => skinsuit}/equals.nim | 0 src/{variantsugar => skinsuit}/private/utils.nim | 0 src/{variantsugar => skinsuit}/sum.nim | 0 src/{variantsugar => skinsuit}/unionfield.nim | 0 src/variantsugar.nim | 2 -- tests/test_combined.nim | 2 +- tests/test_conditional.nim | 2 +- tests/test_dispatch.nim | 4 ++-- tests/test_equals.nim | 2 +- tests/test_sum.nim | 2 +- tests/test_unionfield.nim | 2 +- 17 files changed, 18 insertions(+), 14 deletions(-) rename variantsugar.nimble => skinsuit.nimble (87%) create mode 100644 src/skinsuit.nim rename src/{variantsugar => skinsuit}/conditional.nim (98%) rename src/{variantsugar => skinsuit}/dispatch.nim (100%) rename src/{variantsugar => skinsuit}/equals.nim (100%) rename src/{variantsugar => skinsuit}/private/utils.nim (100%) rename src/{variantsugar => skinsuit}/sum.nim (100%) rename src/{variantsugar => skinsuit}/unionfield.nim (100%) delete mode 100644 src/variantsugar.nim diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 08d10d4..2e85dbb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: variantsugar +name: skinsuit on: push: diff --git a/README.md b/README.md index 82ff298..596a419 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# variantsugar +# skinsuit Utility macros mostly for object variants ```nim -import variantsugar +import skinsuit type Value {.sum, equals.} = object case kind: _ diff --git a/variantsugar.nimble b/skinsuit.nimble similarity index 87% rename from variantsugar.nimble rename to skinsuit.nimble index a6941ff..d6d5897 100644 --- a/variantsugar.nimble +++ b/skinsuit.nimble @@ -1,6 +1,6 @@ # Package -version = "0.2.1" +version = "0.2.2" author = "metagn" description = "utility macros mostly for object variants" license = "MIT" @@ -18,7 +18,7 @@ when (NimMajor, NimMinor) >= (1, 4): task docs, "build docs for all modules": when declared(buildDocs): - buildDocs(gitUrl = "https://github.com/metagn/variantsugar") + buildDocs(gitUrl = "https://github.com/metagn/skinsuit") else: echo "docs task not implemented, need nimbleutils" diff --git a/src/skinsuit.nim b/src/skinsuit.nim new file mode 100644 index 0000000..5ccfa1b --- /dev/null +++ b/src/skinsuit.nim @@ -0,0 +1,2 @@ +import skinsuit/[conditional, sum, unionfield, equals, dispatch] +export conditional, sum, unionfield, equals, dispatch diff --git a/src/variantsugar/conditional.nim b/src/skinsuit/conditional.nim similarity index 98% rename from src/variantsugar/conditional.nim rename to src/skinsuit/conditional.nim index d905b4d..ab47ecb 100644 --- a/src/variantsugar/conditional.nim +++ b/src/skinsuit/conditional.nim @@ -1,5 +1,9 @@ ## object variants generalized to any condition for each possible union value +# todo use custom {.union.} implementation for JS and nimscript +# for JS, can be `distinct JsRoot` that gets `cast` +# for nimscript, can be `pointer` that gets `cast`? + runnableExamples: type Foo {.conditional.} = ref object num: int diff --git a/src/variantsugar/dispatch.nim b/src/skinsuit/dispatch.nim similarity index 100% rename from src/variantsugar/dispatch.nim rename to src/skinsuit/dispatch.nim diff --git a/src/variantsugar/equals.nim b/src/skinsuit/equals.nim similarity index 100% rename from src/variantsugar/equals.nim rename to src/skinsuit/equals.nim diff --git a/src/variantsugar/private/utils.nim b/src/skinsuit/private/utils.nim similarity index 100% rename from src/variantsugar/private/utils.nim rename to src/skinsuit/private/utils.nim diff --git a/src/variantsugar/sum.nim b/src/skinsuit/sum.nim similarity index 100% rename from src/variantsugar/sum.nim rename to src/skinsuit/sum.nim diff --git a/src/variantsugar/unionfield.nim b/src/skinsuit/unionfield.nim similarity index 100% rename from src/variantsugar/unionfield.nim rename to src/skinsuit/unionfield.nim diff --git a/src/variantsugar.nim b/src/variantsugar.nim deleted file mode 100644 index 1a54002..0000000 --- a/src/variantsugar.nim +++ /dev/null @@ -1,2 +0,0 @@ -import variantsugar/[conditional, sum, unionfield, equals, dispatch] -export conditional, sum, unionfield, equals, dispatch diff --git a/tests/test_combined.nim b/tests/test_combined.nim index f3d1292..f7042a8 100644 --- a/tests/test_combined.nim +++ b/tests/test_combined.nim @@ -1,4 +1,4 @@ -import variantsugar/[sum, equals, dispatch] +import skinsuit/[sum, equals, dispatch] block: type Value {.sum, equals.} = object diff --git a/tests/test_conditional.nim b/tests/test_conditional.nim index dde92f4..23e3f8c 100644 --- a/tests/test_conditional.nim +++ b/tests/test_conditional.nim @@ -1,5 +1,5 @@ when not defined(js) and not defined(nimscript): - import variantsugar/conditional + import skinsuit/conditional conditional: type Foo = ref object diff --git a/tests/test_dispatch.nim b/tests/test_dispatch.nim index b593473..2655ccb 100644 --- a/tests/test_dispatch.nim +++ b/tests/test_dispatch.nim @@ -1,4 +1,4 @@ -import variantsugar/dispatch +import skinsuit/dispatch block: # on parameter name type Foo = object @@ -75,7 +75,7 @@ block: # first parameter addStr(f, s) doAssert s == @["int 0", "float 1.2", "float 3.4", "int 567"] -import variantsugar/sum +import skinsuit/sum block: # combined type Value {.sum.} = object diff --git a/tests/test_equals.nim b/tests/test_equals.nim index 78e616d..0108003 100644 --- a/tests/test_equals.nim +++ b/tests/test_equals.nim @@ -1,4 +1,4 @@ -import variantsugar/equals +import skinsuit/equals block: type Foo {.equals.} = object diff --git a/tests/test_sum.nim b/tests/test_sum.nim index 80478e7..5babd17 100644 --- a/tests/test_sum.nim +++ b/tests/test_sum.nim @@ -1,4 +1,4 @@ -import variantsugar/sum +import skinsuit/sum block: sum: diff --git a/tests/test_unionfield.nim b/tests/test_unionfield.nim index 8743a3c..a9ded02 100644 --- a/tests/test_unionfield.nim +++ b/tests/test_unionfield.nim @@ -1,4 +1,4 @@ -import variantsugar/unionfield +import skinsuit/unionfield block: type Foo {.unionField.} = ref object