[−][src]Struct toio::Searcher
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]
&'_ mut self,
timeout: Duration
) -> Result<Vec<Cube>>
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]
&'_ mut self,
timeout: Duration
) -> Result<Cube>
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,