mirror of
https://github.com/danog/libdvb.git
synced 2024-11-26 20:04:39 +01:00
Macro hygiene
This commit is contained in:
parent
983725c618
commit
4e8bf47e16
@ -83,15 +83,15 @@ impl AsRawFd for FeDevice {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! get_dtv_properties {
|
macro_rules! get_dtv_properties {
|
||||||
( $device:expr, $( $property:ident ),+ ) => { (|| -> ::anyhow::Result<_> {
|
( $device:expr, $( $property:ident ),+ ) => { (|| -> ::anyhow::Result<_> {
|
||||||
let mut input = [ $( $property(DtvPropertyRequest::default()), )* ];
|
let mut input = [ $( $property($crate::fe::sys::DtvPropertyRequest::default()), )* ];
|
||||||
$device.get_properties(&mut input).context("Error fetching properties")?;
|
::anyhow::Context::context($device.get_properties(&mut input), "Error fetching properties")?;
|
||||||
let mut iterator = input.iter();
|
let mut iterator = input.iter();
|
||||||
Ok((
|
Ok((
|
||||||
$(
|
$(
|
||||||
match iterator.next() {
|
::anyhow::Context::with_context(match iterator.next() {
|
||||||
Some($property(d)) => d.get(),
|
Some($property(d)) => d.get(),
|
||||||
_ => ::anyhow::Result::Err(anyhow!("Missing value")),
|
_ => ::anyhow::Result::Err(::anyhow::anyhow!("Missing value")),
|
||||||
}.with_context(|| format!("Error unpacking {}", stringify!($property)))?,
|
}, || format!("Error unpacking {}", stringify!($property)))?,
|
||||||
)*
|
)*
|
||||||
))
|
))
|
||||||
})()}
|
})()}
|
||||||
@ -101,7 +101,7 @@ macro_rules! get_dtv_properties {
|
|||||||
macro_rules! set_dtv_properties {
|
macro_rules! set_dtv_properties {
|
||||||
( $device:expr, $( $property:ident($data:expr) ),+ ) => {
|
( $device:expr, $( $property:ident($data:expr) ),+ ) => {
|
||||||
$device.set_properties(&[
|
$device.set_properties(&[
|
||||||
$( $property(DtvPropertyRequest::new($data)), )*
|
$( $property($crate::fe::sys::DtvPropertyRequest::new($data)), )*
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use crate::get_dtv_properties;
|
|||||||
|
|
||||||
use {
|
use {
|
||||||
super::{sys::*, FeDevice},
|
super::{sys::*, FeDevice},
|
||||||
anyhow::{Context, Result},
|
anyhow::{Result},
|
||||||
std::fmt,
|
std::fmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user