Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(serde_at): deserialize _ #216

Merged
merged 2 commits into from
Jan 20, 2025
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
24 changes: 0 additions & 24 deletions atat/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@

let tx_mock = crate::tx_mock::TxMock::new(TX_CHANNEL.publisher().unwrap());
let client: Client<crate::tx_mock::TxMock, TEST_RX_BUF_LEN> =
Client::new(tx_mock, &RES_SLOT, unsafe { BUF.as_mut() }, $config);

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged

Check warning on line 262 in atat/src/blocking/client.rs

View workflow job for this annotation

GitHub Actions / Test

creating a mutable reference to mutable static is discouraged
(client, TX_CHANNEL.subscriber().unwrap(), &RES_SLOT)
}};
}
Expand Down Expand Up @@ -423,30 +423,6 @@
sent.await.unwrap();
}

#[tokio::test]
async fn invalid_response() {
let (mut client, mut tx, rx) = setup!(Config::new());

// String last
let cmd = TestRespStringCmd {
fun: Functionality::APM,
rst: Some(ResetMode::DontReset),
};

let sent = tokio::spawn(async move {
tx.next_message_pure().await;
rx.signal_response(Ok(b"+CUN: 22,16,22")).unwrap();
});

tokio::task::spawn_blocking(move || {
assert_eq!(Err(Error::Parse), client.send(&cmd));
})
.await
.unwrap();

sent.await.unwrap();
}

#[tokio::test]
async fn custom_timeout() {
static CALL_COUNT: AtomicU64 = AtomicU64::new(0);
Expand Down
4 changes: 2 additions & 2 deletions serde_at/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<'a> Deserializer<'a> {
self.index = self.slice.len();
return Ok(&self.slice[start..]);
} else if let Some(c) = self.peek() {
if (c as char).is_alphanumeric() || (c as char).is_whitespace() {
if (c as char).is_ascii() && c >= 32 {
self.eat_char();
} else {
return Err(Error::EofWhileParsingString);
Expand Down Expand Up @@ -473,7 +473,7 @@ impl<'a, 'de> de::Deserializer<'de> for &'a mut Deserializer<'de> {
visitor.visit_borrowed_str(self.parse_str()?)
}
_ => {
if (peek as char).is_alphabetic() {
if (peek as char).is_ascii() && peek >= 32 {
visitor.visit_bytes(self.parse_bytes()?)
} else {
Err(Error::InvalidType)
Expand Down
Loading