Skip to content

Commit

Permalink
feat: add more IntoFieldData implementations for primitive types (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmindlin authored Oct 5, 2022
1 parent e89466e commit 3bfc1f0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@ impl IntoFieldData for bool {
}
}

impl IntoFieldData for u8 {
fn into_field_data(&self) -> FieldData {
FieldData::UNumber(*self as u64)
}
}

impl IntoFieldData for u16 {
fn into_field_data(&self) -> FieldData {
FieldData::UNumber(*self as u64)
}
}

impl IntoFieldData for u32 {
fn into_field_data(&self) -> FieldData {
FieldData::UNumber(*self as u64)
Expand All @@ -75,6 +87,18 @@ impl IntoFieldData for u64 {
}
}

impl IntoFieldData for i8 {
fn into_field_data(&self) -> FieldData {
FieldData::Number(*self as i64)
}
}

impl IntoFieldData for i16 {
fn into_field_data(&self) -> FieldData {
FieldData::Number(*self as i64)
}
}

impl IntoFieldData for i32 {
fn into_field_data(&self) -> FieldData {
FieldData::Number(*self as i64)
Expand Down

0 comments on commit 3bfc1f0

Please sign in to comment.