Struct cannyls_rpc::DeviceRegistryHandle [−][src]
pub struct DeviceRegistryHandle { /* fields omitted */ }
デバイスレジストリを操作するためのハンドル.
Methods
impl DeviceRegistryHandle
[src]
impl DeviceRegistryHandle
pub fn put_device(&self, device_id: DeviceId, device: Device) -> Result<()>
[src]
pub fn put_device(&self, device_id: DeviceId, device: Device) -> Result<()>
レジストリにデバイスを登録する.
同じIDのデバイスが既に存在する場合には、新しいもので上書きされる.
デバイスが途中で終了した場合でも、明示的に削除するまでは、レジストリには残り続ける.
Errors
対象レジストリインスタンスがドロップしている場合には、ErrorKind::Other
エラーが返る.
pub fn delete_device(&self, device_id: DeviceId) -> Result<()>
[src]
pub fn delete_device(&self, device_id: DeviceId) -> Result<()>
レジストリからデバイスを削除する.
指定されたデバイスが存在しない場合には、単に無視される.
Errors
対象レジストリインスタンスがドロップしている場合には、ErrorKind::Other
エラーが返る.
pub fn get_device<T: ?Sized>(&self, device_id: &T) -> Result<DeviceHandle> where
T: Hash + Eq + Debug,
DeviceId: Borrow<T>,
[src]
pub fn get_device<T: ?Sized>(&self, device_id: &T) -> Result<DeviceHandle> where
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 contains_device(&self, device_id: &DeviceId) -> bool
レジストリにデバイスが登録されているかどうかを判定する.
pub fn list_devices(&self) -> Result<Vec<(DeviceId, DeviceHandle)>>
[src]
pub fn list_devices(&self) -> Result<Vec<(DeviceId, DeviceHandle)>>
Trait Implementations
impl Debug for DeviceRegistryHandle
[src]
impl Debug for DeviceRegistryHandle
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for DeviceRegistryHandle
[src]
impl Clone for DeviceRegistryHandle
fn clone(&self) -> DeviceRegistryHandle
[src]
fn clone(&self) -> DeviceRegistryHandle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
Auto Trait Implementations
impl Send for DeviceRegistryHandle
impl Send for DeviceRegistryHandle
impl Sync for DeviceRegistryHandle
impl Sync for DeviceRegistryHandle