No description
Find a file
2023-11-21 12:08:31 +01:00
src change template names 2023-11-20 12:16:41 +01:00
tests change template names 2023-11-20 12:16:41 +01:00
.gitignore init 2023-11-20 00:05:55 +01:00
LICENSE.md add license 2023-11-20 00:12:35 +01:00
objaccess.nimble init 2023-11-20 00:05:55 +01:00
README.md Update README.md 2023-11-21 12:08:31 +01:00

This package lets you generate getter and setter procs for object types. For situations where you only want the outside world to be able to do one of those, so exporting the field doesnt do the trick.

There are two options:

setable, getable macros

type Obj* = object
  a, b: int
  c: bool
  d: string

Obj.getable(a, b)
Obj.setable(d)

customAccess pragma

Note: this doens't work with mutual recursive types.

type Obj* {.customAccess.} = object
  a {.getable.}, b {.getable.}: int
  c: bool
  d {.setable.}: string