pub struct Devices { /* private fields */ }
Expand description
Devices collection.
This data structure holds devices of arbitrary categories (cameras, telescopes, etc.) and allows to register and access them by their kind and index.
Implementations§
Source§impl Devices
impl Devices
Sourcepub const fn default() -> Self
pub const fn default() -> Self
Create an empty collection of devices.
Same as Default::default
but works in const contexts.
Sourcepub fn iter_all(&self) -> impl Iterator<Item = (TypedDevice, usize)>
pub fn iter_all(&self) -> impl Iterator<Item = (TypedDevice, usize)>
Iterate over all registered devices.
The second element of the tuple is the index of the device within its category (not the whole collection).
Source§impl Devices
impl Devices
Sourcepub fn register<DynTrait: ?Sized>(
&mut self,
device: impl RegistrableDevice<DynTrait>,
)
pub fn register<DynTrait: ?Sized>( &mut self, device: impl RegistrableDevice<DynTrait>, )
Register a device in the storage.
device
can be an instance of any of the category traits (Camera
, Telescope
, etc.).
Note that you don’t need to provide the generic type parameter - it’s here only for type inference purposes to allow “overloads” that automatically register device into the correct storage.
Sourcepub fn iter<DynTrait: ?Sized + RetrieavableDevice>(
&self,
) -> impl ExactSizeIterator<Item = Arc<DynTrait>>
pub fn iter<DynTrait: ?Sized + RetrieavableDevice>( &self, ) -> impl ExactSizeIterator<Item = Arc<DynTrait>>
Iterate over all devices of a given type.
Trait Implementations§
Source§impl Extend<TypedDevice> for Devices
impl Extend<TypedDevice> for Devices
Source§fn extend<T: IntoIterator<Item = TypedDevice>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = TypedDevice>>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl FromIterator<TypedDevice> for Devices
impl FromIterator<TypedDevice> for Devices
Source§fn from_iter<T: IntoIterator<Item = TypedDevice>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = TypedDevice>>(iter: T) -> Self
Creates a value from an iterator. Read more
Auto Trait Implementations§
impl Freeze for Devices
impl !RefUnwindSafe for Devices
impl Send for Devices
impl Sync for Devices
impl Unpin for Devices
impl !UnwindSafe for Devices
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more