Skip to content

Commit 7ba3672

Browse files
committed
style: cargo fmt
1 parent efd75b1 commit 7ba3672

4 files changed

Lines changed: 17 additions & 19 deletions

File tree

crates/wind-tuic/Cargo.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ license = "MIT OR Apache-2.0"
88

99
[features]
1010
default = ["server", "client"]
11-
server = []
12-
client = []
11+
decode = []
12+
encode = []
13+
server = ["decode"]
14+
client = ["encode"]
1315

1416
[dependencies]
1517
# Async
1618
tokio = { version = "*", default-features = false }
1719
tokio-util = { version = "*", features = ["codec"] }
1820

1921
tokio-stream = "*"
20-
futures-util = { version = "*", default-features = false, features = ["sink"]}
22+
futures-util = { version = "*", default-features = false, features = ["sink"] }
2123

2224
bytes = "*"
2325
uuid = "*"

crates/wind-tuic/src/proto/v5/addr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub enum AddressType {
3131
Other(u8),
3232
}
3333
// https://github.com/zephry-works/wind/blob/main/crates/wind-tuic/SPEC.md#5-address-encoding
34-
#[cfg(feature = "server")]
34+
#[cfg(feature = "decode")]
3535
impl Decoder for AddressCodec {
3636
type Error = crate::Error;
3737
type Item = Address;
@@ -102,7 +102,7 @@ impl Decoder for AddressCodec {
102102
}
103103
}
104104

105-
#[cfg(feature = "client")]
105+
#[cfg(feature = "encode")]
106106
impl Encoder<Address> for AddressCodec {
107107
type Error = crate::Error;
108108

crates/wind-tuic/src/proto/v5/cmd.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub enum Command {
2929
}
3030

3131
// https://github.com/zephry-works/wind/blob/main/crates/wind-tuic/SPEC.md#3-command-specifications
32-
#[cfg(feature = "server")]
32+
#[cfg(feature = "decode")]
3333
impl Decoder for CommandCodec {
3434
type Error = crate::Error;
3535
type Item = Command;
@@ -52,17 +52,13 @@ impl Decoder for CommandCodec {
5252
if src.len() < 8 {
5353
return Ok(None);
5454
}
55-
let assos_id = src.get_u16();
56-
let pkt_id = src.get_u16();
57-
let frag_total = src.get_u8();
58-
let frag_id = src.get_u8();
59-
let size = src.get_u16();
55+
6056
Ok(Some(Command::Packet {
61-
assos_id,
62-
pkt_id,
63-
frag_total,
64-
frag_id,
65-
size,
57+
assos_id: src.get_u16(),
58+
pkt_id: src.get_u16(),
59+
frag_total: src.get_u8(),
60+
frag_id: src.get_u8(),
61+
size: src.get_u16(),
6662
}))
6763
}
6864
CommandType::Dissociate => {
@@ -85,7 +81,7 @@ impl Decoder for CommandCodec {
8581
}
8682
}
8783

88-
#[cfg(feature = "client")]
84+
#[cfg(feature = "encode")]
8985
impl Encoder<Command> for CommandCodec {
9086
type Error = crate::Error;
9187

crates/wind-tuic/src/proto/v5/header.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl Header {
3636
}
3737
}
3838

39-
#[cfg(feature = "server")]
39+
#[cfg(feature = "decode")]
4040
impl Decoder for HeaderCodec {
4141
type Error = crate::Error;
4242
type Item = Header;
@@ -63,7 +63,7 @@ impl Decoder for HeaderCodec {
6363
}
6464
}
6565

66-
#[cfg(feature = "client")]
66+
#[cfg(feature = "encode")]
6767
impl Encoder<Header> for HeaderCodec {
6868
type Error = crate::Error;
6969

0 commit comments

Comments
 (0)