A sub-field accessor macro for the Nim programming language.
Find a file
2016-06-21 10:07:15 -06:00
tests Create initial subfield macro and tests 2016-06-21 10:02:17 -06:00
.gitignore Ignore vim files 2016-06-21 10:01:05 -06:00
LICENSE Initial commit 2016-06-21 09:29:22 -06:00
README.md Add readme instructions 2016-06-21 10:07:15 -06:00
subfield.nim Create initial subfield macro and tests 2016-06-21 10:02:17 -06:00
subfield.nimble Create initial subfield macro and tests 2016-06-21 10:02:17 -06:00

subfield

A sub-field accessor macro for the Nim programming language. This lets you access nested fields within a Nim object or ref object.

Installation

nimble install subfield

#Usage

import subfield

type
  C = object
    y: int
  B = object
    x: int
    c: C
  A = ref object
    b: B

var c = C(y: 0)
var b = B(x: 5, c: c)
var a = A(b: b)

echo a.x
echo a.y

# Prints:
#  5
#  0