Skip to content

Commit 392a37e

Browse files
committed
fix: se/de number enum
1 parent 03439a3 commit 392a37e

File tree

6 files changed

+20
-6
lines changed

6 files changed

+20
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Build Server Protocol
22

3+
State: Working, Unstable, feature releases might break 0.1
34
[Build Server Protocol](https://build-server-protocol.github.io/docs/specification.html) client, server and type definition in rust.
45

56
## Example

bsp-server/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# BSP-Server
2+
3+
State: Working, Unstable, feature releases might break 0.1
4+
5+
A build server scaffold, exposing a synchronous crossbeam-channel based API.
6+
This crate handles protocol handshaking and parsing messages, while you
7+
control the message dispatch loop yourself.
8+
9+
Run with `RUST_LOG=bsp_server=debug` to see all the messages.
10+
11+
inspired by lsp-server

bsp-types/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# BSP-Types
22

3+
State: Working, Unstable, feature releases might break 0.1
4+
35
Collection of Build Protocol types as defined in
46
[specification](https://build-server-protocol.github.io/docs/specification.html). There are
57
might be slight renaming for convenience so don't expect one-to-one mapping of interface names.

bsp-types/src/bt_did_change.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ impl BuildTargetEvent {
4141
}
4242
}
4343

44-
#[derive(Debug, Serialize, Deserialize, Clone)]
44+
#[derive(Clone, Debug, serde_repr::Deserialize_repr, serde_repr::Serialize_repr)]
45+
#[repr(u16)]
4546
pub enum BuildTargetEventKind {
4647
/// The build target is new (default).
4748
Created = 1,

bsp-types/src/bt_sources.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ impl Sources {
136136
}
137137
}
138138

139-
/// TODO: correclty derive number enum with serde_repr
140-
#[derive(Debug, Serialize, Deserialize)]
139+
#[derive(Debug, serde_repr::Deserialize_repr, serde_repr::Serialize_repr)]
140+
#[repr(u16)]
141141
pub enum SourceKind {
142142
/// The source item references a normal file.
143143
File = 1,

bsp-types/src/message_type.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use serde::{Deserialize, Serialize};
2-
3-
#[derive(Debug, Serialize, Deserialize, Clone)]
1+
#[derive(Clone, Debug, serde_repr::Deserialize_repr, serde_repr::Serialize_repr)]
2+
#[repr(u16)]
43
pub enum MessageType {
54
/// An error message.
65
Error = 1,

0 commit comments

Comments
 (0)