[][src]Struct cannyls::device::DeviceHandle

pub struct DeviceHandle(_);

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

Implementations

impl DeviceHandle[src]

pub fn request(&self) -> DeviceRequest[src]

デバイスの発行するリクエストのビルダを返す.

pub fn metrics(&self) -> &Arc<DeviceMetrics>[src]

デバイスのメトリクスを返す.

pub fn allocate_lump_data(&self, size: usize) -> Result<LumpData>[src]

ストレージのブロック境界にアライメントされたメモリ領域を保持するLumpDataインスタンスを返す.

LumpData::new関数に比べて、このメソッドが返したLumpDataインスタンスは、 デバイスが管理しているストレージのブロック境界に合わせたアライメントが行われているため、 ストレージへのPUT時に余計なメモリコピーが発生することがなく、より効率的となる.

注意

このメソッドが返したLumpDataインスタンスを、別の(ブロックサイズが異なる)ストレージに 保存しようとした場合には、エラーが発生する.

Errors

指定されたサイズがMAX_SIZEを超えている場合は、ErrorKind::InvalidInputエラーが返される.

pub fn allocate_lump_data_with_bytes(&self, bytes: &[u8]) -> Result<LumpData>[src]

allocate_lump_dataメソッドにデータの初期化を加えたメソッド.

このメソッドの呼び出しは、以下のコードと等価となる:

This example is not tested
let mut data = track!(self.allocate_lump_data(bytes.len()))?;
data.as_bytes_mut().copy_from_slice(bytes);

詳細な挙動に関してはallocate_lump_dataのドキュメントを参照のこと.

Trait Implementations

impl Clone for DeviceHandle[src]

impl Debug for DeviceHandle[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> 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.