added instructions for adding to your zig project
This commit is contained in:
19
README.md
19
README.md
@@ -3,6 +3,25 @@
|
||||
first why does this exist i didnt like having to write `*anyopaque` for all the functions that are in the implemention of an interface so i made wrapper do it for you. This now hides all the nasty polymorphism shenanigans within the interface where it belongs.
|
||||
Additionally it also allows you to use your implementation normally rather than having to pass it through the interface first.
|
||||
|
||||
# using this lib
|
||||
|
||||
```bash
|
||||
$ zig fetch --save git+https://git.sirlilpanda.studio/sirlilpanda/zig-interface-helpers
|
||||
```
|
||||
|
||||
in `build.zig`
|
||||
```zig
|
||||
|
||||
const iface = b.dependency("interface", .{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
exe.root_module.addImport("interface", interface.module("interface"));
|
||||
|
||||
```
|
||||
|
||||
|
||||
# how does this lib work
|
||||
|
||||
This lib basically removes the annoying conversion back to the original type in your implementation and instead does that conversion in a wrapper functions instead. This should now allow you to write more code and less boilerplate.
|
||||
|
||||
Reference in New Issue
Block a user