https://github.com/lemon-mint/vstruct
Code Generation Based High Speed Data Serialization Tool
https://github.com/lemon-mint/vstruct
deserialization go golang high-performance serialization vstruct zerocopy
Last synced: 7 days ago
JSON representation
Code Generation Based High Speed Data Serialization Tool
- Host: GitHub
- URL: https://github.com/lemon-mint/vstruct
- Owner: lemon-mint
- License: mit
- Created: 2021-11-29T12:42:21.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-27T02:26:27.000Z (over 2 years ago)
- Last Synced: 2025-04-03T01:33:31.560Z (about 2 months ago)
- Topics: deserialization, go, golang, high-performance, serialization, vstruct, zerocopy
- Language: Go
- Homepage: https://vstruct.pages.dev
- Size: 24.9 MB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/lemon-mint/vstruct/blob/main/LICENSE)
[](https://github.com/lemon-mint/vstruct/releases/latest)
[](https://www.npmjs.com/package/vstruct)# vstruct
Code Generation Based High Speed Data Serialization Tool
# Installation
## 1. From NPM (recommended)
```bash
npm install -g vstruct
```## 2. Go Get (Go Install) (also recommended)
```bash
go install github.com/lemon-mint/vstruct/cli/vstruct@latest
```## 3. From Source
```
git clone https://github.com/lemon-mint/vstruct.git
cd vstruct
go build -o vstruct ./cli/vstruct
```## 4. Pre-compiled binaries
[https://github.com/lemon-mint/vstruct/releases/latest](https://github.com/lemon-mint/vstruct/releases/latest)
# Vstruct Syntax
## 0. Primitive Types
### 0.1. Boolean
---
```
bool: bool # true or false
```### 0.2. Signed Integers
---
```
int8: int8 # signed 8-bit integer
int16: int16 # signed 16-bit integer
int32: int32 # signed 32-bit integer
int64: int64 # signed 64-bit integer
```### 0.3. Unsigned Integers
---
```
uint8: uint8 # unsigned 8-bit integer
uint16: uint16 # unsigned 16-bit integer
uint32: uint32 # unsigned 32-bit integer
uint64: uint64 # unsigned 64-bit integer
```### 0.4. Floating Point
---
```
float32: float32 # 32-bit floating point (IEEE 754)
float64: float64 # 64-bit floating point (IEEE 754)
```### 0.5. Bytes
---
```
bytes: bytes # variable length bytes
```### 0.6. String
---
```
string: string # variable length string
```## 1. Enum
```vstruct
enum MyEnum {
one,
two,
three
}
```## 2. Struct
```vstruct
struct MyStruct {
uint8 a;
uint16 b;
uint32 c;
uint64 d;
string e;
MyEnum f;
}
```## 3. Alias
```vstruct
alias UUID = string;
```# Vstruct CLI Usage
```
vstruct [options]
```## Options
```
-o Output file name (default: .<.go|.py|.dart|.rs>)
-s Prints the generated code to stdout
-v Print version and exit
-h Print help and exit
-l Print license and exit
```## Languages
```
go: Go
python: Python
dart: Dart
rust: Rust (Experimental)
```