diff options
author | Zhen Zhang <izgzhen@gmail.com> | 2016-05-03 08:47:27 +0800 |
---|---|---|
committer | Zhen Zhang <izgzhen@gmail.com> | 2016-05-11 15:14:03 +0800 |
commit | c618ee21d0cca19631ebab9a1d735c48a0a7679a (patch) | |
tree | 4d4c8be52f78509cd4cf1a2f5f7ff1f30c1226c7 /components/net_traits/filemanager_thread.rs | |
parent | ab12d8098fcc0517b64643d25683e2e15e665410 (diff) | |
download | servo-c618ee21d0cca19631ebab9a1d735c48a0a7679a.tar.gz servo-c618ee21d0cca19631ebab9a1d735c48a0a7679a.zip |
add filemanager_thread
Diffstat (limited to 'components/net_traits/filemanager_thread.rs')
-rw-r--r-- | components/net_traits/filemanager_thread.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/components/net_traits/filemanager_thread.rs b/components/net_traits/filemanager_thread.rs new file mode 100644 index 00000000000..dfc2d6a5615 --- /dev/null +++ b/components/net_traits/filemanager_thread.rs @@ -0,0 +1,34 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use ipc_channel::ipc::IpcSender; +use std::path::PathBuf; +use uuid::Uuid; + +#[derive(Deserialize, Serialize)] +pub enum FileManagerThreadMsg { + /// Select a single file, return triple (FileID, FileName, lastModified) + SelectFile(IpcSender<FileManagerResult<(Uuid, PathBuf, u64)>>), + + /// Select multiple files, return a vector of triples + SelectFiles(IpcSender<FileManagerResult<Vec<(Uuid, PathBuf, u64)>>>), + + /// Read file, return the bytes + ReadFile(IpcSender<FileManagerResult<Vec<u8>>>, Uuid), + + /// Delete the FileID entry + DeleteFileID(Uuid), +} + +pub type FileManagerResult<T> = Result<T, FileManagerThreadError>; + +#[derive(Deserialize, Serialize)] +pub enum FileManagerThreadError { + /// The selection action is invalid, nothing is selected + InvalidSelection, + /// Failure to process file information such as file name, modified time etc. + FileInfoProcessingError, + /// Failure to read the file content + ReadFileError, +} |