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

Remove Buffers type #193

Merged
merged 4 commits into from
Dec 19, 2023
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
78 changes: 0 additions & 78 deletions atat/src/buffers.rs

This file was deleted.

2 changes: 0 additions & 2 deletions atat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@
// This mod MUST go first, so that the others see its macros.
pub(crate) mod fmt;

mod buffers;
mod config;
pub mod digest;
mod error;
Expand Down Expand Up @@ -261,7 +260,6 @@ pub use serde_at;
#[cfg(feature = "derive")]
pub use heapless;

pub use buffers::Buffers;
pub use config::Config;
pub use digest::{AtDigester, AtDigester as DefaultDigester, DigestResult, Digester, Parser};
pub use error::{CmeError, CmsError, ConnectionError, Error, InternalError};
Expand Down
2 changes: 1 addition & 1 deletion atat_derive/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn add_type_parameter_bound(
let where_type = syn::PredicateType {
bounded_ty: parse_quote!(#ident),
colon_token: <syn::Token![:]>::default(),
bounds: vec![trait_bound].iter().cloned().collect(),
bounds: [trait_bound].iter().cloned().collect(),
lifetimes: None,
};
generics
Expand Down
17 changes: 10 additions & 7 deletions examples/src/bin/embassy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#![feature(type_alias_impl_trait)]
#![allow(incomplete_features)]

use atat::{asynch::AtatClient, AtatIngress, Buffers, DefaultDigester, Ingress};
use atat::{
asynch::{AtatClient, Client},
AtatIngress, DefaultDigester, Ingress, ResponseChannel, UrcChannel,
};
use atat_examples::common;
use embassy_executor::Spawner;
use embassy_executor::_export::StaticCell;
Expand Down Expand Up @@ -47,14 +50,14 @@ async fn main(spawner: Spawner) {
);
let (reader, writer) = uart.split();

static BUFFERS: Buffers<common::Urc, INGRESS_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS> =
Buffers::<common::Urc, INGRESS_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS>::new();

let (ingress, mut client) = BUFFERS.split(
writer,
static RES_CHANNEL: ResponseChannel<INGRESS_BUF_SIZE> = ResponseChannel::new();
static URC_CHANNEL: UrcChannel<Urc, URC_CAPACITY, URC_SUBSCRIBERS> = UrcChannel::new();
let ingress = Ingress::new(
DefaultDigester::<common::Urc>::default(),
atat::Config::default(),
RES_CHANNEL.publisher(),
URC_CHANNEL.publisher(),
);
let mut client = Client::new(writer, RES_CHANNEL.subscriber(), atat::Config::default());

spawner.spawn(ingress_task(ingress, reader)).unwrap();

Expand Down
20 changes: 11 additions & 9 deletions examples/src/bin/std-tokio.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#![feature(async_fn_in_trait)]

Check warning on line 1 in examples/src/bin/std-tokio.rs

View workflow job for this annotation

GitHub Actions / Build (x86_64-unknown-linux-gnu, derive)

the feature `async_fn_in_trait` has been stable since 1.75.0 and no longer requires an attribute to enable

Check warning on line 1 in examples/src/bin/std-tokio.rs

View workflow job for this annotation

GitHub Actions / Build (x86_64-unknown-linux-gnu, derive, log)

the feature `async_fn_in_trait` has been stable since 1.75.0 and no longer requires an attribute to enable

Check warning on line 1 in examples/src/bin/std-tokio.rs

View workflow job for this annotation

GitHub Actions / Test

the feature `async_fn_in_trait` has been stable since 1.75.0 and no longer requires an attribute to enable
#![allow(incomplete_features)]
use atat_examples::common;

use std::process::exit;

use atat::{asynch::AtatClient, AtatIngress, Buffers, Config, DefaultDigester, Ingress};
use atat::{
asynch::{AtatClient, Client},
AtatIngress, Config, DefaultDigester, Ingress, ResponseChannel, UrcChannel,
};
use embedded_io_adapters::tokio_1::FromTokio;
use std::process::exit;
use tokio_serial::SerialStream;

const INGRESS_BUF_SIZE: usize = 1024;
Expand All @@ -16,16 +18,16 @@
async fn main() -> ! {
env_logger::init();

static BUFFERS: Buffers<common::Urc, INGRESS_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS> =
Buffers::<common::Urc, INGRESS_BUF_SIZE, URC_CAPACITY, URC_SUBSCRIBERS>::new();

let (reader, writer) = SerialStream::pair().expect("Failed to create serial pair");

let (ingress, mut client) = BUFFERS.split(
FromTokio::new(writer),
static RES_CHANNEL: ResponseChannel<INGRESS_BUF_SIZE> = ResponseChannel::new();
static URC_CHANNEL: UrcChannel<common::Urc, URC_CAPACITY, URC_SUBSCRIBERS> = UrcChannel::new();
let ingress = Ingress::new(
DefaultDigester::<common::Urc>::default(),
Config::default(),
RES_CHANNEL.publisher().unwrap(),
URC_CHANNEL.publisher(),
);
let mut client = Client::new(FromTokio::new(writer), &RES_CHANNEL, Config::default());

tokio::spawn(ingress_task(ingress, FromTokio::new(reader)));

Expand Down
14 changes: 6 additions & 8 deletions serde_at/src/de/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,16 +176,14 @@ impl<'a> Deserializer<'a> {
if self.is_trailing_parsing {
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() {
self.eat_char();
} else {
return Err(Error::EofWhileParsingString);
}
} else if let Some(c) = self.peek() {
if (c as char).is_alphanumeric() || (c as char).is_whitespace() {
self.eat_char();
} else {
return Ok(&self.slice[start..self.index]);
return Err(Error::EofWhileParsingString);
}
} else {
return Ok(&self.slice[start..self.index]);
}
}
}
Expand Down
Loading