Skip to main content

Handle

Trait Handle 

Source
pub trait Handle: Send + Sync {
    // Required methods
    fn read<'life0, 'async_trait>(
        &'life0 self,
        offset: u64,
        len: u32,
    ) -> Pin<Box<dyn Future<Output = Result<Bytes, SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offset: u64,
        data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<u32, SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn flush<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stat<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<FileInfo, SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn set_times<'life0, 'async_trait>(
        &'life0 self,
        times: FileTimes,
    ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn truncate<'life0, 'async_trait>(
        &'life0 self,
        len: u64,
    ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_dir<'life0, 'life1, 'async_trait>(
        &'life0 self,
        pattern: Option<&'life1 str>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn close<'async_trait>(
        self: Box<Self>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait;

    // Provided method
    fn write_owned<'life0, 'async_trait>(
        &'life0 self,
        offset: u64,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<u32, SmbError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A live open file or directory handle.

One handle per CREATE. The handle is dropped when CLOSE arrives or the session goes away.

Required Methods§

Source

fn read<'life0, 'async_trait>( &'life0 self, offset: u64, len: u32, ) -> Pin<Box<dyn Future<Output = Result<Bytes, SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read up to len bytes at offset. May return fewer.

Source

fn write<'life0, 'life1, 'async_trait>( &'life0 self, offset: u64, data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<u32, SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write data at offset. Returns bytes written.

Source

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Flush buffered writes. May be a no-op on backends that always flush.

Source

fn stat<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<FileInfo, SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stat: current file info.

Source

fn set_times<'life0, 'async_trait>( &'life0 self, times: FileTimes, ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Set timestamps. None fields leave the corresponding field alone.

Source

fn truncate<'life0, 'async_trait>( &'life0 self, len: u64, ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Truncate (or extend) to len bytes. For directories: the protocol layer rejects this before reaching the backend.

Source

fn list_dir<'life0, 'life1, 'async_trait>( &'life0 self, pattern: Option<&'life1 str>, ) -> Pin<Box<dyn Future<Output = Result<Vec<DirEntry>, SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List directory entries matching the optional pattern. v1 ignores pattern if the backend doesn’t implement matching — the dispatcher post-filters as needed for QUERY_DIRECTORY.

Source

fn close<'async_trait>( self: Box<Self>, ) -> Pin<Box<dyn Future<Output = Result<(), SmbError>> + Send + 'async_trait>>
where Self: 'async_trait,

Close the handle. Boxed self lets implementors consume internal state.

Provided Methods§

Source

fn write_owned<'life0, 'async_trait>( &'life0 self, offset: u64, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<u32, SmbError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Write owned data at offset. Backends that need ownership across a blocking boundary can override this to avoid an extra copy.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§