[][src]Struct toio::Searcher

pub struct Searcher { /* fields omitted */ }

Searcher to search cubes.

Implementations

impl Searcher[src]

pub fn new() -> Self[src]

Creates a new searcher instance.

The default search timeout is 3 seconds. Use [Searcher::new_with_timeout][] to specify custom timeout.

pub async fn all<'_>(&'_ mut self) -> Result<Vec<Cube>>[src]

Searches for all cubes.

This searches for cubes for 3 seconds. Use Searcher::all_timeout to use custom timeout.

pub async fn nearest<'_>(&'_ mut self) -> Result<Cube>[src]

Finds the nearest cube.

This searches for cubes for 3 seconds. Use Searcher::nearest_timeout to use custom timeout.

pub async fn all_timeout<'_>(
    &'_ mut self,
    timeout: Duration
) -> Result<Vec<Cube>>
[src]

Searches for all cubes with custom timeout.

Cubes are sorted from nearest to farest.

use std::time::Duration;
use toio::Cube;

#[tokio::main]
async fn main() {
    let cubes = Cube::search().all_timeout(Duration::from_secs(8)).await.unwrap();
}

pub async fn nearest_timeout<'_>(
    &'_ mut self,
    timeout: Duration
) -> Result<Cube>
[src]

Finds the nearest cube with custom timeout.

use std::time::Duration;
use toio::Cube;

#[tokio::main]
async fn main() {
    let cube = Cube::search().nearest_timeout(Duration::from_secs(8)).await.unwrap();
}

Trait Implementations

impl Debug for Searcher[src]

Auto Trait Implementations

impl !RefUnwindSafe for Searcher

impl Send for Searcher

impl !Sync for Searcher

impl Unpin for Searcher

impl !UnwindSafe for Searcher

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.