A simple snowflake generator
|
Adwaith-Rajesh
180efd45ec
bump the min version from 0.16.0-dev to 0.16.0 |
||
|---|---|---|
| src | [LICENSE] | |
| .gitignore | [dev] Hello World | |
| build.zig | [dev] make it an importable module | |
| build.zig.zon | [chore] Update the min version | |
| LICENSE | [LICENSE] | |
| README.md | [docs] Add README | |
Znow
A simple snowflake generator.
Installation
# for dev
zig fetch --save git+https://codeberg.org/Adwaith-Rajesh/znow.git
you can also pick one of the archives from the releases
Usage
In build.zig
conststd=@import("std");pubfnbuild(b:*std.Build)void{...constznow=b.dependency("znow",.{});constexe=b.addExecutable(.{.name="test",.root_module=b.createModule(.{.root_source_file=b.path("..."),...,.imports=&.{.{.name="znow",.module=znow.module("znow"),},},}),});...}Creating snowflakes
The below example create a 100 snowflakes
conststd=@import("std");constznow=@import("znow");pubfnmain(init:std.process.Init)!void{constio=init.io;varflake:znow.Snowflake(false)=.init(io,12);// use true for thread safe implementation// var flake: znow.Snowflake(true) = .init(io, 12);for(0..100)|_|{std.debug.print("flake -> {d}\n",.{tryflake.next()});}}Have any Issues??
Please create a new issue, or join my Discord.