Skip to content

Commit

Permalink
device: del unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
bastibl committed Jul 31, 2024
1 parent ec71ed1 commit bcb2893
Showing 1 changed file with 0 additions and 90 deletions.
90 changes: 0 additions & 90 deletions src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,96 +303,6 @@ impl Device<GenericDevice> {
}
Err(Error::NotFound)
}

/// Creates a [`GenericDevice`] opening the first device with a given `driver`, specified in
/// the `args` or the first device discovered through [`enumerate`](crate::enumerate) that
/// matches the args.
#[cfg(all(feature = "web", not(target_arch = "wasm32")))]
pub fn from_args_with_runtime<A: TryInto<Args>, E: crate::Executor, C: crate::Connect>(
args: A,
executor: E,
connector: C,
) -> Result<Self, Error> {
let args = args.try_into().or(Err(Error::ValueError))?;
let driver = match args.get::<Driver>("driver") {
Ok(d) => Some(d),
Err(Error::NotFound) => None,
Err(e) => return Err(e),
};
#[cfg(all(feature = "aaronia", any(target_os = "linux", target_os = "windows")))]
{
if driver.is_none() || matches!(driver, Some(Driver::Aaronia)) {
match crate::impls::Aaronia::open(&args) {
Ok(d) => {
return Ok(Device {
dev: Arc::new(DeviceWrapper { dev: d }),
})
}
Err(Error::NotFound) => {
if driver.is_some() {
return Err(Error::NotFound);
}
}
Err(e) => return Err(e),
}
}
}
#[cfg(all(feature = "aaronia_http", not(target_arch = "wasm32")))]
{
if driver.is_none() || matches!(driver, Some(Driver::AaroniaHttp)) {
match crate::impls::AaroniaHttp::open_with_runtime(&args, executor, connector) {
Ok(d) => {
return Ok(Device {
dev: Arc::new(DeviceWrapper { dev: d }),
})
}
Err(Error::NotFound) => {
if driver.is_some() {
return Err(Error::NotFound);
}
}
Err(e) => return Err(e),
}
}
}
#[cfg(all(feature = "rtlsdr", not(target_arch = "wasm32")))]
{
if driver.is_none() || matches!(driver, Some(Driver::RtlSdr)) {
match crate::impls::RtlSdr::open(&args) {
Ok(d) => {
return Ok(Device {
dev: Arc::new(DeviceWrapper { dev: d }),
})
}
Err(Error::NotFound) => {
if driver.is_some() {
return Err(Error::NotFound);
}
}
Err(e) => return Err(e),
}
}
}
#[cfg(all(feature = "soapy", not(target_arch = "wasm32")))]
{
if driver.is_none() || matches!(driver, Some(Driver::Soapy)) {
match crate::impls::Soapy::open(&args) {
Ok(d) => {
return Ok(Device {
dev: Arc::new(DeviceWrapper { dev: d }),
})
}
Err(Error::NotFound) => {
if driver.is_some() {
return Err(Error::NotFound);
}
}
Err(e) => return Err(e),
}
}
}
Err(Error::NotFound)
}
}

/// Type for a generic/wrapped hardware driver, implementing the [`DeviceTrait`].
Expand Down

0 comments on commit bcb2893

Please sign in to comment.