diff options
| author | mat <github@matdoes.dev> | 2022-04-30 23:04:18 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-30 23:04:18 -0500 |
| commit | 8313952541c049615af944b87b80c686bbf62073 (patch) | |
| tree | bda219f25ae448c2bd0054ce2187be63f513b02e /azalea-protocol/src/mc_buf | |
| parent | 0dc6decf7f3a4ea273e0eabccd74815c528ba6bd (diff) | |
| download | azalea-drasl-8313952541c049615af944b87b80c686bbf62073.tar.xz | |
Simplify packet macro
Now every packet implements McBufWritable and McBufReadable and uses those so the code doesn't have to be duplicated.
Diffstat (limited to 'azalea-protocol/src/mc_buf')
| -rwxr-xr-x | azalea-protocol/src/mc_buf/mod.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/azalea-protocol/src/mc_buf/mod.rs b/azalea-protocol/src/mc_buf/mod.rs index 4048bae7..d50817fb 100755 --- a/azalea-protocol/src/mc_buf/mod.rs +++ b/azalea-protocol/src/mc_buf/mod.rs @@ -32,6 +32,12 @@ impl From<Vec<u8>> for UnsizedByteArray { } } +impl From<&str> for UnsizedByteArray { + fn from(s: &str) -> Self { + Self(s.as_bytes().to_vec()) + } +} + /// Represents Java's BitSet, a list of bits. #[derive(Debug, Clone, PartialEq, Eq, Hash, McBufReadable, McBufWritable)] pub struct BitSet { |
