Skip to content

Make ads::client::Client sync #39

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ rust-version = "1.63"
byteorder = "1.5.0"
crossbeam-channel = "0.5.13"
itertools = "0.13.0"
oneshot = { version = "0.1.11", default-features = false, features = ["std"] }
thiserror = "2.0"
zerocopy = { version = "0.8.9", features = ["derive"] }

Expand Down
26 changes: 13 additions & 13 deletions examples/adstool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ fn main() {
let args = Args::from_args();

if let Err(e) = main_inner(args) {
eprintln!("Error: {}", e);
eprintln!("Error: {e}");
std::process::exit(1);
}
}
Expand Down Expand Up @@ -403,7 +403,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
let namelen = LE::read_u32(&routeinfo[36..]) as usize;
let host = String::from_utf8_lossy(&routeinfo[44..][..hostlen - 1]);
let name = String::from_utf8_lossy(&routeinfo[44 + hostlen..][..namelen - 1]);
print!("{:-20} {:-22} {:-18}", name, netid, host);
print!("{name:-20} {netid:-22} {host:-18}");
if flags & 0x01 != 0 {
print!(" temporary");
}
Expand All @@ -415,7 +415,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
}
println!();
}
_ => println!("Route entry {} too short", subindex),
_ => println!("Route entry {subindex} too short"),
}
}
}
Expand Down Expand Up @@ -459,7 +459,7 @@ fn main_inner(args: Args) -> Result<(), Error> {
}
}
Ok(Event::Eof) => break,
Err(e) => return Err(Error::Str(format!("error parsing target desc XML: {}", e))),
Err(e) => return Err(Error::Str(format!("error parsing target desc XML: {e}"))),
_ => (),
}
}
Expand Down Expand Up @@ -507,9 +507,9 @@ fn main_inner(args: Args) -> Result<(), Error> {
let info = dev.get_info()?;
println!("Device: {} {}.{}.{}", info.name, info.major, info.minor, info.version);
let (state, dev_state) = dev.get_state()?;
println!("Current state: {:?}", state);
println!("Current state: {state:?}");
if let Some(newstate) = subargs.target_state {
println!("Set new state: {:?}", newstate);
println!("Set new state: {newstate:?}");
dev.write_control(newstate, dev_state)?;
}
}
Expand Down Expand Up @@ -553,10 +553,10 @@ fn main_inner(args: Args) -> Result<(), Error> {

println!("ID: {}", format_guid(guid));
if let Some(exp) = exp_time {
println!(" Expires: {}", exp);
println!(" Expires: {exp}");
}
if inst_total != 0 {
println!(" Instances used: {}/{}", inst_used, inst_total);
println!(" Instances used: {inst_used}/{inst_total}");
}
}
}
Expand Down Expand Up @@ -748,18 +748,18 @@ fn print_read_value(typ: VarType, buf: &[u8], hex: bool) {
match buf[0] {
0 => println!("FALSE"),
1 => println!("TRUE"),
n => println!("non-bool ({})", n),
n => println!("non-bool ({n})"),
}
return;
}
VarType::Real => {
let v = f32::from_le_bytes(buf[..4].try_into().expect("size"));
println!("{}", v);
println!("{v}");
return;
}
VarType::Lreal => {
let v = f64::from_le_bytes(buf[..8].try_into().expect("size"));
println!("{}", v);
println!("{v}");
return;
}
VarType::Byte => buf[0] as i128,
Expand All @@ -773,9 +773,9 @@ fn print_read_value(typ: VarType, buf: &[u8], hex: bool) {
};
// Only reaches here for integer types
if hex {
println!("{:#x}", value);
println!("{value:#x}");
} else {
println!("{}", value);
println!("{value}");
}
}

Expand Down
4 changes: 2 additions & 2 deletions examples/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fn main() {
std::thread::spawn(move || {
for msg in recv_notify.iter() {
for sample in msg.samples() {
println!("notify: {:?}", sample);
println!("notify: {sample:?}");
}
}
});
Expand Down Expand Up @@ -39,7 +39,7 @@ fn main() {
),
)
.unwrap();
println!("{} {}", h1, h2);
println!("{h1} {h2}");
loop {
std::thread::sleep(std::time::Duration::from_secs(1));
}
Expand Down
Loading