0.49.0 • Published 25 days ago
bendec v0.49.0
Code generator for Rust, TypeScript, C++ and Java
Supports: Primitives, Structs, Enums, Unions, Arrays, Aliases
Type Definitions:
[{
"kind": "Struct",
"name": "User",
"fields": [{
"name": "firstName",
"type": "char",
"length": 16 // It's an Array
}, {
"name": "lastName",
"type": "char",
"length": 16
}, {
"name": "uri",
"type": "Uri"
}, {
"name": "age",
"type": "Age"
}]
}]
Generated Rust code:
#[repr(C, packed)]
#[derive(Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub struct User {
pub first_name: [u8; 16],
pub last_name: [u8; 16],
pub uri: Uri, // type definition omitted
pub age: Age,
}
Generated C++ code:
struct User {
char firstName[16];
char lastName[16];
Uri uri;
Age age;
friend std::ostream &operator << (std::ostream &, const User &);
};
Generated TypeScript code:
export interface User {
firstName: Buffer // Can be overriden to `string`
lastName: Buffer
uri: Uri
age: Age
}
Generated Java code:
// look in /src/tests/generated/java/
Binary encoder / decoder featuring fixed-size arrays for JavaScript
const bendec = new Bendec({
definitions, // todo
getVariant // todo
})
// get your Buffer from somewhere
const buffer = Buffer.alloc(bendec.getSize('User'))
// wrap the buffer
const user = bendec.wrap('User', buffer)
// just get / set properties
user.firstName = 'Lorem'
// nested object
user.address.postcode = 'E1 123'
// your Buffer is now updated
console.log(buffer)
0.49.0
25 days ago
0.48.0
4 months ago
0.47.0
4 months ago
0.46.0
4 months ago
0.43.0
10 months ago
0.44.0
7 months ago
0.45.0
5 months ago
0.42.0
10 months ago
0.41.0
1 year ago
0.38.0
2 years ago
0.40.0
1 year ago
0.39.0
2 years ago
0.37.0
2 years ago
0.36.0
2 years ago
0.34.0
2 years ago
0.32.0
2 years ago
0.30.0
2 years ago
0.29.0
2 years ago
0.35.0
2 years ago
0.33.0
2 years ago
0.31.0
2 years ago
0.28.0
2 years ago
0.27.0
2 years ago
0.26.0
2 years ago
0.25.0
2 years ago
0.24.0
2 years ago
0.23.0
2 years ago
0.22.0
2 years ago
0.21.0
3 years ago
0.20.0
3 years ago
0.19.0
3 years ago
0.18.0
3 years ago
0.17.0
3 years ago
0.16.0
3 years ago
0.15.0
3 years ago
0.14.4
3 years ago
0.14.3
4 years ago
0.14.2
4 years ago
0.14.0
4 years ago
0.14.1
4 years ago
0.13.0
4 years ago
0.12.0
4 years ago
0.11.1
4 years ago
0.11.0
4 years ago
0.10.0
4 years ago
0.9.0
4 years ago
0.7.3
4 years ago
0.7.2
4 years ago
0.7.1
4 years ago
0.7.0
4 years ago
0.6.0
4 years ago
0.5.3
5 years ago
0.5.2
5 years ago
0.5.1
5 years ago
0.5.0
5 years ago
0.4.2
6 years ago
0.4.1
6 years ago
0.4.0
6 years ago
0.3.0
6 years ago
0.2.0
6 years ago
0.1.0
6 years ago