Skip to content

Commit b662f28

Browse files
committed
Initial commit.
0 parents  commit b662f28

13 files changed

+2231
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target/

Cargo.lock

+190
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "nine"
3+
version = "0.2.0"
4+
description = "The 9p protocol as a serde format and message types."
5+
authors = ["Kevin M Granger <[email protected]>"]
6+
license = "MPL-2.0"
7+
8+
[badges.maintenance]
9+
status = "experimental"
10+
11+
[dependencies]
12+
serde = "1.0"
13+
serde_derive = "1.0"
14+
byteorder = "1.1.0"
15+
bitflags = "1.0.3"
16+
failure = "0.1.2"

IDEAS.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Future Ideas
2+
3+
## Progressive Type Enhancement
4+
5+
Server implementers may wish for their users to not have to deal with tags. After all, there's essentially only one correct thing to do, so why not have
6+
the server handle it? This means users would only have to return the main part
7+
of the response.
8+
9+
```rust
10+
mod core_types {
11+
pub struct Tversion {
12+
pub msize: u32,
13+
pub version: String
14+
}
15+
16+
pub struct Rversion {
17+
pub msize: u32,
18+
pub version: String
19+
}
20+
}
21+
mod tagged_types {
22+
pub struct Tversion {
23+
pub tag: u32,
24+
#[serde(flatten)]
25+
pub version: super::core_types::Tversion,
26+
}
27+
pub struct Rversion {
28+
pub tag: u32,
29+
#[serde(flatten)]
30+
pub version: super::core_types::Rversion,
31+
}
32+
}
33+
34+
// then a server could have
35+
36+
pub mod prelude {
37+
pub use super::tagged_types::{Tversion, Tother}; // etc
38+
pub use super::core_types::{Rversion, Rother}; // etc
39+
}
40+
41+
// then the method could be
42+
43+
fn version(&mut self, msg: Tversion) -> Result<Rversion>;
44+
45+
// and thus the user has the tag if they want it, but don't have to return it.
46+
```
47+
48+
## Ahead of time lengths
49+
50+
We have to do length computation at serialize time because we can't specialize for structs (unless we manually implemented Serialize, which would defeat half of the point of this library, and make the types strange for other formats to deal with). This would be easier with specialization.
51+
52+
But in the end, what does this get us? The ability to serialize a message without using a buffer-- but wouldn't we always want to use a buffer anyway?
53+
54+
## Protocol extension
55+
56+
There's plenty of types that don't exist in 9p-- floats, bools, maps, etc. For existing versions of the protocol, we can just ignore that. But part of the purpose of this library is allowing experimentation.
57+
58+
Maybe we can make a trait that requires you to expose what the regular (de)serializer needs, but allows you to implement the (de)serialize methods yourself.

0 commit comments

Comments
 (0)