pub async fn discover(
    search_target: &SearchTarget,
    timeout: Duration,
) -> Result<impl Stream<Item = Result<Device>>> {
    Ok(ssdp_client::search(search_target, timeout, 3)
        .await?
        .map_err(Error::SSDPError)
        .map(|res| Ok(res?.location().parse()?))
        .and_then(Device::from_url))
}
/// Discovers UPnP devices on the network.
///
/// # Example usage:
/// ```rust,no_run
/// use futures::prelude::*;
/// use std::time::Duration;
/// use rupnp::ssdp::SearchTarget;
///
/// # async fn discover() -> Result<(), rupnp::Error> {
/// let devices = rupnp::discover(&SearchTarget::RootDevice, Duration::from_secs(3)).await?;
/// pin_utils::pin_mut!(devices);
///
/// while let Some(device) = devices.try_next().await? {
///     println!(
///         "{} - {} @ {}",
///         device.device_type(),
///         device.friendly_name(),
///         device.url()
///     );
/// }
///
/// # Ok(())
/// # }
/// ```
// TODO: doc include once stable
Discovers UPnP devices on the network.
Discovers UPnP devices on the network .
pub async fn discover(
    search_target: &SearchTarget,
    timeout: Duration,
) -> Result<impl Stream<Item = Result<Device>>> {
    Ok(ssdp_client::search(search_target, timeout, 3)
        .await?
        .map_err(Error::SSDPError)
        .map(|res| Ok(res?.location().parse()?))
        .and_then(Device::from_url))
}
pub async fn discover ( search_target : & SearchTarget , timeout : Duration , ) -> Result < impl Stream < Item = Result < Device > > > { Ok ( ssdp_client :: search ( search_target , timeout , 3 ) . await ? . map_err ( Error :: SSDPError ) . map ( | res | Ok ( res ? . location ( ) . parse ( ) ? ) ) . and_then ( Device :: from_url ) ) }
Discovers UPnP devices on the network.
Discovers UPnP devices on the network .
search_target
&SearchTarget
timeout
Duration
search_target
&SearchTarget
timeout
Duration
example usage:
```rust,no_run
use futures::prelude::*;
use std::time::Duration;
use rupnp::ssdp::SearchTarget.
` ` ` rust no_run use futures :: prelude :: * ; use std :: time :: Duration ; use rupnp :: ssdp :: SearchTarget .
async fn discover() -> result<(), rupnp::error> {
let devices = rupnp::discover(&SearchTarget::RootDevice, Duration::from_secs(3)).await?;
pin_utils::pin_mut!(devices).

while let Some(device) = devices.try_next().await.
let devices = rupnp :: discover ( &SearchTarget :: RootDevice Duration :: from_secs ( 3 )) . await? ; pin_utils :: pin_mut! ( devices ) . while let Some ( device ) = devices . try_next () . await .
ok(())
None
}
```
TODO: doc include once stable
` ` ` TODO : doc include once stable