pub trait Handle: Send + Sync {
Show 19 methods
// Required methods
fn read<'life0, 'async_trait>(
&'life0 self,
offset: u64,
len: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<Bytes>> + 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 = SmbResult<u32>> + 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 = SmbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<FileInfo>> + 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 = SmbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_attributes<'life0, 'async_trait>(
&'life0 self,
attributes: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn truncate<'life0, 'async_trait>(
&'life0 self,
len: u64,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + 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 = SmbResult<Vec<DirEntry>>> + 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 = SmbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided methods
fn write_owned<'life0, 'async_trait>(
&'life0 self,
offset: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn list_dir_sized<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: Option<&'life1 str>,
ea_size: bool,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<DirEntry>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn link_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn dir_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Option<Box<dyn DirWatch>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn streams<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<StreamInfo>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn peek_streams<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_entries: &'life1 [(&'life2 str, &'life3 [(StreamName, u32)])],
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Vec<Option<(u64, Bytes)>>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn eas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Ea>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn set_eas<'life0, 'life1, 'async_trait>(
&'life0 self,
_eas: &'life1 [Ea],
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn as_any(&self) -> Option<&(dyn Any + Send + Sync)> { ... }
}Expand description
A live open file or directory handle.
One handle per CREATE. close runs when CLOSE arrives, and when the
tree, session or connection the open belongs to ends. A durable open’s
handle stays open past the end of its session or connection, until its
client takes the open back, the open expires, or something else closes
it; see the crate docs.
Required Methods§
Sourcefn read<'life0, 'async_trait>(
&'life0 self,
offset: u64,
len: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn read<'life0, 'async_trait>(
&'life0 self,
offset: u64,
len: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<Bytes>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Read up to len bytes at offset. May return fewer.
Sourcefn write<'life0, 'life1, 'async_trait>(
&'life0 self,
offset: u64,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn write<'life0, 'life1, 'async_trait>(
&'life0 self,
offset: u64,
data: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Write data at offset. Returns bytes written. A write that starts
past the end of the file leaves a gap that reads as zeros.
Sourcefn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn flush<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Flush buffered writes. May be a no-op on backends that always flush.
Sourcefn stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<FileInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stat<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<FileInfo>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stat: current file info.
Sourcefn set_times<'life0, 'async_trait>(
&'life0 self,
times: FileTimes,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + 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 = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set timestamps on a file or directory. None fields leave the
corresponding time alone.
Return SmbError::NotSupported for an access or write time the
backend cannot store. A backend that cannot store a creation time
ignores it and applies the other fields; a request with only a
creation time then succeeds and changes nothing.
change_time is the time of the last change: a backend whose
storage moves it to the current time on every change, as POSIX ctime
does, may keep doing so and not store the requested value.
LocalFsBackend sets access and write times on every host and
creation time on Windows and macOS. Elsewhere it ignores the creation
time. The host keeps the change time.
Sourcefn set_attributes<'life0, 'async_trait>(
&'life0 self,
attributes: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn set_attributes<'life0, 'async_trait>(
&'life0 self,
attributes: u32,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Set the attributes (MS-FSCC 2.6) of a file or directory to
attributes, a combination of FILE_ATTRIBUTE_READONLY (0x1),
HIDDEN (0x2), SYSTEM (0x4), ARCHIVE (0x20), TEMPORARY
(0x100), OFFLINE (0x1000) and NOT_CONTENT_INDEXED (0x2000).
Flags left out are cleared. The protocol layer calls this only when
the request differs from the attributes Handle::stat reports.
Return SmbError::NotSupported if a flag cannot be stored, or
store what the backend can and ignore the rest, as long as
Handle::stat then reports what is stored.
LocalFsBackend on Windows stores every flag as the host’s
attributes. On Unix hosts it stores READONLY on files as the
absence of write permission bits and ignores the other flags, and
READONLY on a directory: FileInfo::file_attributes stays 0
there.
Sourcefn truncate<'life0, 'async_trait>(
&'life0 self,
len: u64,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn truncate<'life0, 'async_trait>(
&'life0 self,
len: u64,
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Truncate (or extend) to len bytes; bytes added by extending read as
zeros. For directories: the protocol layer rejects this before
reaching the backend.
Sourcefn list_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<DirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: Option<&'life1 str>,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<DirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List directory entries matching the optional pattern. The pattern
uses the wildcards of MS-FSA 2.1.4.4: * and ?, and the DOS forms
< (DOS_STAR), > (DOS_QM) and " (DOS_DOT).
QUERY_DIRECTORY returns the result as is, so the backend applies the
pattern. The . and .. entries are left out; QUERY_DIRECTORY adds
them.
Provided Methods§
Sourcefn write_owned<'life0, 'async_trait>(
&'life0 self,
offset: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn write_owned<'life0, 'async_trait>(
&'life0 self,
offset: u64,
data: Vec<u8>,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + 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.
Sourcefn list_dir_sized<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: Option<&'life1 str>,
ea_size: bool,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<DirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_dir_sized<'life0, 'life1, 'async_trait>(
&'life0 self,
pattern: Option<&'life1 str>,
ea_size: bool,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<DirEntry>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handle::list_dir for a caller that reads the
FileInfo::ea_size of the entries only when ea_size is set;
without it a backend may leave that 0 and skip reading it.
QUERY_DIRECTORY calls this when a listing starts or restarts, with
ea_size set when the share serves extended attributes and the
information class carries EaSize; the layout with Finder data for
macOS clients carries none. Queries that carry on a listing reuse
its entries, so one carried on under a class with EaSize after it
started under one without reports 0 until it restarts. The default
calls list_dir.
Sourcefn link_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn link_count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<u32>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Number of hard links to the file, reported as NumberOfLinks by
FileStandardInformation. 0 means the file has been deleted while
open. The default reports 1.
Sourcefn dir_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn dir_is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
True if this directory has no entries other than . and ..,
including entries Handle::list_dir leaves out. The default checks
list_dir(None), so a backend whose listing hides entries overrides
it.
Sourcefn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Option<Box<dyn DirWatch>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn watch<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Option<Box<dyn DirWatch>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Watch this directory for changes to its entries made by anyone,
including outside the server. The server asks one open of a watched
directory and shares the watch among every watch of that directory;
it may outlive the handle, and is dropped with the directory’s last
watch. The default returns Ok(None): the server then reports only
the changes made through it.
Sourcefn streams<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<StreamInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn streams<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<StreamInfo>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The named streams of the file or directory this handle is on,
whichever of its streams the handle is open on, in the order
FileStreamInformation lists them. The default stream is not listed.
Called only when BackendCapabilities::named_streams is set. The
default returns none.
Sourcefn peek_streams<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_entries: &'life1 [(&'life2 str, &'life3 [(StreamName, u32)])],
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Vec<Option<(u64, Bytes)>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn peek_streams<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_entries: &'life1 [(&'life2 str, &'life3 [(StreamName, u32)])],
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Vec<Option<(u64, Bytes)>>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
The named streams of entries of this directory: for each entry of
entries, a name and the streams to read with the most bytes to
read of each, one result per stream, in order, with the stream’s
size and up to that many bytes from its start. A result is None
when the entry has no such stream, or when it or the entry cannot
be read; stream names compare without regard to case. An entry
that is not a regular file or a directory has none: no FIFO,
socket or device is opened in a way that blocks, and no link is
followed out of the share.
QUERY_DIRECTORY for a macOS client that negotiated Apple’s
extensions calls it once per response, for AFP_AfpInfo of the
entries the response carries, other than “.” and “..”, and
AFP_Resource of the files among them. Called only on a directory
and only when BackendCapabilities::named_streams is set. A
handle that wraps another has to forward it, or listings carry no
Finder data. The default returns SmbError::NotSupported;
listings then carry no Finder info or resource fork sizes.
Sourcefn eas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Ea>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn eas<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = SmbResult<Vec<Ea>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The extended attributes of the file or directory this handle is
on, in the order FileFullEaInformation lists them. The protocol
layer leaves out those with names a client cannot send, empty
values or values over 65535 bytes. Called only when
BackendCapabilities::extended_attributes is set, and never on a
handle of a named stream. The default returns none.
Sourcefn set_eas<'life0, 'life1, 'async_trait>(
&'life0 self,
_eas: &'life1 [Ea],
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_eas<'life0, 'life1, 'async_trait>(
&'life0 self,
_eas: &'life1 [Ea],
) -> Pin<Box<dyn Future<Output = SmbResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Changes the extended attributes of the file or directory this
handle is on: each of eas replaces the attribute of its name, or
adds it, and one with an empty value removes it, if there is one.
Names compare without regard to ASCII case; a replaced attribute
may keep the spelling it had. A name appears once in eas. All
of them apply or none does.
The protocol layer has checked the names, and that the attributes
the file ends up with take at most 65531 bytes, counting 5 bytes,
the name and the value of each. Fail with
SmbError::EaTooLarge when they need more room than the backend
has, and with SmbError::EaNameInvalid for a name it cannot
store. Called only when
BackendCapabilities::extended_attributes is set, and never on a
handle of a named stream. The default returns
SmbError::NotSupported.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".