mirror of
https://github.com/danbulant/convex-macros
synced 2026-05-19 03:58:31 +00:00
add nix dev shell and update readme
This commit is contained in:
parent
e22fa46dc3
commit
097d15f3ec
3 changed files with 35 additions and 3 deletions
9
.envrc
Normal file
9
.envrc
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
# the shebang is ignored, but nice for editors
|
||||
|
||||
if type -P lorri &>/dev/null; then
|
||||
eval "$(lorri direnv)"
|
||||
else
|
||||
echo 'while direnv evaluated .envrc, could not find the command "lorri" [https://github.com/nix-community/lorri]'
|
||||
use nix
|
||||
fi
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# convex-macros
|
||||
|
||||
[](https://github.com/ragkit/convex-macros/actions/workflows/ci.yml) [](./LICENSE) [](https://crates.io/crates/ragkit_convex_macros)
|
||||
[](https://github.com/ragkit/convex-macros/actions/workflows/ci.yml) [](./LICENSE)
|
||||
|
||||
Macros to help make Convex in Rust nice
|
||||
|
||||
|
|
@ -90,13 +90,13 @@ assert_eq!(
|
|||
| `v.union(...)` | Generated `enum` | |
|
||||
| `v.object({field: ...})` | Generated `struct` | Field names can't be rust keywords (like `type`) |
|
||||
| `v.bytes()` | not implemented | |
|
||||
| `v.array(values)` | not implemented | |
|
||||
| `v.array(values)` | `Vec<T>` | |
|
||||
| `v.any()` | not implemented | |
|
||||
|
||||
## Limitations
|
||||
|
||||
- This is experimental and may not be "production quality", use with caution.
|
||||
- `v.bytes()`, `v.array()`, `v.any()` are not yet supported.
|
||||
- `v.bytes()`, `v.any()` are not yet supported.
|
||||
- Field names must be valid Rust identifiers, so keywords like `type` cannot be a field name. Map it to `_type`, `kind`, `t`, etc.
|
||||
- Union variant names are always named like: `Variant1`, `Variant2`, etc.
|
||||
- The first acceptable union branch will be used if there are multiples that could validly parse data.
|
||||
|
|
|
|||
23
shell.nix
Normal file
23
shell.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
# rust-rover things
|
||||
fenix = import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { };
|
||||
rust-toolchain =
|
||||
fenix.default.toolchain;
|
||||
in
|
||||
pkgs.mkShell rec {
|
||||
buildInputs = with pkgs;[
|
||||
openssl
|
||||
pkg-config
|
||||
cmake
|
||||
zlib
|
||||
rust-toolchain
|
||||
];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
];
|
||||
LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}";
|
||||
OPENSSL_DIR="${pkgs.openssl.dev}";
|
||||
OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib";
|
||||
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
|
||||
}
|
||||
Loading…
Reference in a new issue