Skip to content

Commit 359b208

Browse files
committed
Update README.md
1 parent fdd42b0 commit 359b208

5 files changed

Lines changed: 40 additions & 48 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# 🐡 bufferfish
22

3-
`bufferfish` is utility library for working with binary network messages between Rust and TypeScript, such as over WebSockets. It provides a simple API for encoding and decoding data into binary arrays, as well as generating TypeScript definitions and decoding functions from your Rust code.
3+
`bufferfish` is utility library for working with binary network messages between Rust and TypeScript, such as over WebSockets. It provides a simple API for encoding and decoding data into binary arrays, as well as generating TypeScript definitions and encode/decode functions from your Rust code.
44

5-
_This library has an unstable API and may be missing some basic functionality. I can't recommend using it in production, although I am using it for my own production project._
5+
_This library has an unstable API. I can't recommend using it in production, although I am using it for my own production project._
66

77
## Table of Contents
88

@@ -51,7 +51,7 @@ The TypeScript implementation lives here. The API is generally mirrored from the
5151

5252
Use `cargo add bufferfish` to add the Rust library to your project.
5353

54-
Use `npm install bufferfish` to add the TypeScript library to your project.
54+
Use `bun install bufferfish` to add the TypeScript library to your project.
5555

5656
## Examples
5757

rust/bufferfish-core/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ Core types, traits, and logic implementations for [bufferfish](https://github.co
66

77
See the [main project repository](https://github.com/robertwayne/bufferfish) for more details.
88

9-
## Contributing
10-
11-
`bufferfish` is open to contributions, however it should be noted that the library was created for my own game projects, and I am not interested in making it widely general-purpose. If you still have a feature request or bug fix that you think would be useful to others, feel free to open an issue or PR.
12-
139
## License
1410

1511
`bufferfish` source code is dual-licensed under either

rust/bufferfish-derive/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ Macros for [bufferfish](https://github.com/robertwayne/bufferfish).
66

77
See the [main project repository](https://github.com/robertwayne/bufferfish) for more details.
88

9-
## Contributing
10-
11-
`bufferfish` is open to contributions, however it should be noted that the library was created for my own game projects, and I am not interested in making it widely general-purpose. If you still have a feature request or bug fix that you think would be useful to others, feel free to open an issue or PR.
12-
139
## License
1410

1511
`bufferfish` source code is dual-licensed under either

rust/bufferfish/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
`bufferfish` is utility library for working with binary network messages between Rust and TypeScript, such as over WebSockets. It provides a simple API for encoding and decoding data into binary arrays, as well as generating TypeScript definitions and decoding functions from your Rust code.
44

5-
_This library has an unstable API and may be missing some basic functionality. I can't recommend using it in production, although I am using it for my own production project._
5+
_This library has an unstable API. I can't recommend using it in production, although I am using it for my own production project._
66

77
# Table of Contents
88

@@ -23,7 +23,7 @@ _This library has an unstable API and may be missing some basic functionality. I
2323

2424
Use `cargo add bufferfish` to add the Rust library to your project.
2525

26-
Use `npm install bufferfish` to add the TypeScript library to your project.
26+
Use `bun install bufferfish` to add the TypeScript library to your project.
2727

2828
## Examples
2929

typescript/README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,35 @@
44

55
See the [project repository](https://github.com/robertwayne/bufferfish) for more details, including how to interop with Rust.
66

7-
_This library has an unstable API and may be missing some basic functionality. I can't recommend using it in production, although I am using it for my own production project._
7+
_This library has an unstable API. I can't recommend using it in production, although I am using it for my own production project._
88

99
## Table of Contents
1010

11-
- [Getting Started](#getting-started)
12-
- [Examples](#examples)
11+
- [Getting Started](#getting-started)
12+
- [Examples](#examples)
1313
- [Writing to a Bufferfish](#writing-to-a-bufferfish)
1414
- [Reading from a Bufferfish](#reading-from-a-bufferfish)
15-
- [TypeScript Code Generation](#typescript-code-generation)
15+
- [TypeScript Code Generation](#typescript-code-generation)
1616
- [Using Generated Decoding Functions](#using-generated-decoding-functions)
17-
- [Encodable Types](#encodable-types)
18-
- [Feature Flags (Rust)](#feature-flags-rust)
19-
- [Notes](#notes)
20-
- [Security](#security)
21-
- [Contributing](#contributing)
22-
- [License](#license)
17+
- [Encodable Types](#encodable-types)
18+
- [Feature Flags (Rust)](#feature-flags-rust)
19+
- [Notes](#notes)
20+
- [Security](#security)
21+
- [Contributing](#contributing)
22+
- [License](#license)
2323

2424
## Getting Started
2525

2626
Use `cargo add bufferfish` to add the Rust library to your project.
2727

28-
Use `npm install bufferfish` to add the TypeScript library to your project.
28+
Use `bun install bufferfish` to add the TypeScript library to your project.
2929

3030
## Examples
3131

3232
### Writing to a Bufferfish
3333

3434
```typescript
35-
import { Bufferfish } from 'bufferfish'
35+
import { Bufferfish } from "bufferfish"
3636

3737
const ws = new WebSocket("ws://127.0.0.1:3000")
3838
ws.binaryType = "arraybuffer"
@@ -47,14 +47,14 @@ ws.send(bf.view())
4747
### Reading from a Bufferfish
4848

4949
```typescript
50-
import { Bufferfish } from 'bufferfish'
50+
import { Bufferfish } from "bufferfish"
5151

5252
const ws = new WebSocket("ws://127.0.0.1:3000")
5353
ws.binaryType = "arraybuffer"
5454

5555
onmessage = (event) => {
56-
const bf = new Bufferfish(event.data)
57-
const id = bf.readUint8()
56+
const bf = new Bufferfish(event.data)
57+
const id = bf.readUint8()
5858

5959
if (id === 0) {
6060
const message = bf.readString()
@@ -139,8 +139,8 @@ const ws = new WebSocket("ws://127.0.0.1:3000")
139139
ws.binaryType = "arraybuffer"
140140

141141
ws.onmessage = (event) => {
142-
const bf = new Bufferfish(event.data)
143-
const packetId = bf.readUint16()
142+
const bf = new Bufferfish(event.data)
143+
const packetId = bf.readUint16()
144144

145145
if (packetId === PacketId.Join) {
146146
const packet = decodeJoinPacket(bf)
@@ -152,27 +152,27 @@ ws.onmessage = (event) => {
152152

153153
## Encodable Types
154154

155-
Supported Types | Decodes As
156-
--------------------------- | ---------------------
157-
`u8` | `number`
158-
`u16` | `number`
159-
`u32` | `number`
160-
`i8` | `number`
161-
`i16` | `number`
162-
`i32` | `number`
163-
`bool` | `boolean`
164-
`String` | `string`
165-
`Vec<T> where T: Encodable` | `Array<T>`
166-
`T where T: Encodable` | `object` or primitive
167-
168-
_*The reverse is true for decoding._
155+
| Supported Types | Decodes As |
156+
| --------------------------- | --------------------- |
157+
| `u8` | `number` |
158+
| `u16` | `number` |
159+
| `u32` | `number` |
160+
| `i8` | `number` |
161+
| `i16` | `number` |
162+
| `i32` | `number` |
163+
| `bool` | `boolean` |
164+
| `String` | `string` |
165+
| `Vec<T> where T: Encodable` | `Array<T>` |
166+
| `T where T: Encodable` | `object` or primitive |
167+
168+
_\*The reverse is true for decoding._
169169

170170
## Feature Flags (Rust)
171171

172-
Flag | Default | Description | Dependencies
173-
-------------- | -------- | --------------------------------------------------------------- | ------------------------------------------------
174-
`pretty-print` | Disabled | Enables pretty-printing of buffer output. | `unicode-width`
175-
`derive` | Disabled | Enables the `#[derive(Encode)]` and `#[derive(Decode)]` macros. | `syn`, `quote`, `proc-macro2`, `proc-macro-error` |
172+
| Flag | Default | Description | Dependencies |
173+
| -------------- | -------- | --------------------------------------------------------------- | ------------------------------------------------- |
174+
| `pretty-print` | Disabled | Enables pretty-printing of buffer output. | `unicode-width` |
175+
| `derive` | Disabled | Enables the `#[derive(Encode)]` and `#[derive(Decode)]` macros. | `syn`, `quote`, `proc-macro2`, `proc-macro-error` |
176176

177177
## Notes
178178

0 commit comments

Comments
 (0)