Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generator/sbpg/targets/resources/rust/sbp_cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default = []
async = ["futures", "dencode/async"]
serde = ["dep:serde", "serde-big-array"]
json = ["serde", "serde_json", "base64"]
float_roundtrip = ["serde_json/float_roundtrip"]
float_roundtrip = ["serde", "serde_json/float_roundtrip"]
link = ["slotmap"]

[lib]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub enum Sbp {
Unknown( Unknown ),
}

#[cfg(feature = "serde")]
#[cfg(feature = "serde_json")]
impl<'de> serde::Deserialize<'de> for Sbp {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
2 changes: 1 addition & 1 deletion rust/sbp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ default = []
async = ["futures", "dencode/async"]
serde = ["dep:serde", "serde-big-array"]
json = ["serde", "serde_json", "base64"]
float_roundtrip = ["serde_json/float_roundtrip"]
float_roundtrip = ["serde", "serde_json/float_roundtrip"]
link = ["slotmap"]

[lib]
Expand Down
2 changes: 1 addition & 1 deletion rust/sbp/src/messages/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ pub enum Sbp {
Unknown(Unknown),
}

#[cfg(feature = "serde")]
#[cfg(feature = "serde_json")]
impl<'de> serde::Deserialize<'de> for Sbp {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
9 changes: 5 additions & 4 deletions rust/sbp/src/sbp_string.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use std::convert::TryInto;
use std::fmt;
use std::fmt::Formatter;
use std::marker::PhantomData;

use bytes::{Buf, BufMut};
#[cfg(feature = "serde")]
use serde::de::{Error, Visitor};

use crate::wire_format::WireFormat;
Expand Down Expand Up @@ -84,7 +83,7 @@ impl<'de, E> serde::Deserialize<'de> for SbpString<Vec<u8>, E> {
impl<'de, E> Visitor<'de> for SbpStringVisitor<E> {
type Value = SbpString<Vec<u8>, E>;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("string")
}

Expand Down Expand Up @@ -126,12 +125,14 @@ impl<'de, E, const LEN: usize> serde::Deserialize<'de> for SbpString<[u8; LEN],
where
D: serde::Deserializer<'de>,
{
use std::convert::TryInto;

struct SbpStringVisitor<E, const LEN: usize>(PhantomData<SbpString<[u8; LEN], E>>);

impl<'de, E, const LEN: usize> Visitor<'de> for SbpStringVisitor<E, LEN> {
type Value = SbpString<[u8; LEN], E>;

fn expecting(&self, formatter: &mut Formatter) -> fmt::Result {
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str("string")
}

Expand Down
7 changes: 7 additions & 0 deletions scripts/ci_build_rust.bash
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ else
exit 1
fi

cargo build --no-default-features -p sbp
cargo build --no-default-features -p sbp --features serde
cargo build --no-default-features -p sbp --features json
cargo build --no-default-features -p sbp --features async
cargo build --no-default-features -p sbp --features link
cargo build --no-default-features -p sbp --features float_roundtrip

if [ "$RUNNER_OS" == "Linux" ]; then
cargo build --all --release --target=x86_64-unknown-linux-musl
cd target/x86_64-unknown-linux-musl/release
Expand Down