-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commands): vanilla arg types and props, fix some graph issues
- Loading branch information
Showing
14 changed files
with
446 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::io::Write; | ||
|
||
use ferrumc_net_codec::encode::{NetEncode, NetEncodeOpts, NetEncodeResult}; | ||
use tokio::io::AsyncWrite; | ||
|
||
#[derive(Clone, Debug, PartialEq, Default)] | ||
pub struct FloatParserFlags { | ||
pub min: Option<f32>, | ||
pub max: Option<f32>, | ||
} | ||
|
||
impl NetEncode for FloatParserFlags { | ||
fn encode<W: Write>(&self, writer: &mut W, opts: &NetEncodeOpts) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode(writer, opts)?; | ||
self.min.encode(writer, opts)?; | ||
self.max.encode(writer, opts) | ||
} | ||
|
||
async fn encode_async<W: AsyncWrite + Unpin>( | ||
&self, | ||
writer: &mut W, | ||
opts: &NetEncodeOpts, | ||
) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode_async(writer, opts).await?; | ||
self.min.encode_async(writer, opts).await?; | ||
self.max.encode_async(writer, opts).await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::io::Write; | ||
|
||
use ferrumc_net_codec::encode::{NetEncode, NetEncodeOpts, NetEncodeResult}; | ||
use tokio::io::AsyncWrite; | ||
|
||
#[derive(Clone, Debug, PartialEq, Default)] | ||
pub struct IntParserFlags { | ||
pub min: Option<i32>, | ||
pub max: Option<i32>, | ||
} | ||
|
||
impl NetEncode for IntParserFlags { | ||
fn encode<W: Write>(&self, writer: &mut W, opts: &NetEncodeOpts) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode(writer, opts)?; | ||
self.min.encode(writer, opts)?; | ||
self.max.encode(writer, opts) | ||
} | ||
|
||
async fn encode_async<W: AsyncWrite + Unpin>( | ||
&self, | ||
writer: &mut W, | ||
opts: &NetEncodeOpts, | ||
) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode_async(writer, opts).await?; | ||
self.min.encode_async(writer, opts).await?; | ||
self.max.encode_async(writer, opts).await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use std::io::Write; | ||
|
||
use ferrumc_net_codec::encode::{NetEncode, NetEncodeOpts, NetEncodeResult}; | ||
use tokio::io::AsyncWrite; | ||
|
||
#[derive(Clone, Debug, PartialEq, Default)] | ||
pub struct LongParserFlags { | ||
pub min: Option<i64>, | ||
pub max: Option<i64>, | ||
} | ||
|
||
impl NetEncode for LongParserFlags { | ||
fn encode<W: Write>(&self, writer: &mut W, opts: &NetEncodeOpts) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode(writer, opts)?; | ||
self.min.encode(writer, opts)?; | ||
self.max.encode(writer, opts) | ||
} | ||
|
||
async fn encode_async<W: AsyncWrite + Unpin>( | ||
&self, | ||
writer: &mut W, | ||
opts: &NetEncodeOpts, | ||
) -> NetEncodeResult<()> { | ||
let mut flags = 0u8; | ||
if self.min.is_some() { | ||
flags |= 0x01; | ||
} | ||
if self.max.is_some() { | ||
flags |= 0x02; | ||
} | ||
flags.encode_async(writer, opts).await?; | ||
self.min.encode_async(writer, opts).await?; | ||
self.max.encode_async(writer, opts).await | ||
} | ||
} |
Oops, something went wrong.