[−][src]Struct cannyls_rpc::DeviceRegistryHandle
デバイスレジストリを操作するためのハンドル.
Methods
impl DeviceRegistryHandle
[src]
pub fn put_device(&self, device_id: DeviceId, device: Device) -> Result<()>
[src]
レジストリにデバイスを登録する.
同じIDのデバイスが既に存在する場合には、新しいもので上書きされる.
デバイスが途中で終了した場合でも、明示的に削除するまでは、レジストリには残り続ける.
Errors
対象レジストリインスタンスがドロップしている場合には、ErrorKind::Other
エラーが返る.
pub fn delete_device(&self, device_id: DeviceId) -> Result<()>
[src]
レジストリからデバイスを削除する.
指定されたデバイスが存在しない場合には、単に無視される.
Errors
対象レジストリインスタンスがドロップしている場合には、ErrorKind::Other
エラーが返る.
pub fn get_device<T: ?Sized>(&self, device_id: &T) -> Result<DeviceHandle> where
T: Hash + Eq + Debug,
DeviceId: Borrow<T>,
[src]
T: Hash + Eq + Debug,
DeviceId: Borrow<T>,
レジストリに登録されているデバイスを取得する.
未登録のデバイスが指定された場合にはNone
が返される.
注意
この操作はDeviceRegistry
とハンドルを繋ぐチャンネルを経由せずに行われる.
そのため、並列度が高い場合のスケーラビリティには優れるが、
put_device
やdelete_device
とは異なり、処理順序が直列化されることは、
念頭においておく必要がある.
例えばput_device
の呼び出し直後に、get_device
を呼び出した場合には、
None
が返ってくる可能性がある.
また、レジストリインスタンスがドロップされている場合には、常にNone
が返される.
Errors
デバイス用のロック獲得に失敗した場合には、ErrorKind::Other
エラーが返される.
存在しないデバイスが指定された場合には、ErrorKind::InvalidInput
エラーが返される.
pub fn contains_device(&self, device_id: &DeviceId) -> bool
[src]
レジストリにデバイスが登録されているかどうかを判定する.
pub fn list_devices(&self) -> Result<Vec<(DeviceId, DeviceHandle)>>
[src]
Trait Implementations
impl Clone for DeviceRegistryHandle
[src]
fn clone(&self) -> DeviceRegistryHandle
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for DeviceRegistryHandle
[src]
Auto Trait Implementations
impl RefUnwindSafe for DeviceRegistryHandle
impl Send for DeviceRegistryHandle
impl Sync for DeviceRegistryHandle
impl Unpin for DeviceRegistryHandle
impl UnwindSafe for DeviceRegistryHandle
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> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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>,