[][src]Struct cannyls_rpc::DeviceRegistryHandle

pub struct DeviceRegistryHandle { /* fields omitted */ }

デバイスレジストリを操作するためのハンドル.

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]

レジストリに登録されているデバイスを取得する.

未登録のデバイスが指定された場合にはNoneが返される.

注意

この操作はDeviceRegistryとハンドルを繋ぐチャンネルを経由せずに行われる. そのため、並列度が高い場合のスケーラビリティには優れるが、 put_devicedelete_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]

レジストリに登録されているデバイス一覧を取得する.

Errors

デバイス用のロック獲得に失敗した場合には、ErrorKind::Otherエラーが返される.

Trait Implementations

impl Clone for DeviceRegistryHandle[src]

impl Debug for DeviceRegistryHandle[src]

Auto Trait Implementations

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> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.