pub struct LibfwClient { /* private fields */ }Expand description
WASM engine facade. Construct via new LibfwClient(options).
Implementations§
Source§impl LibfwClient
impl LibfwClient
Sourcepub fn new(opts: JsValue) -> LibfwClient
pub fn new(opts: JsValue) -> LibfwClient
Create an engine. options may include:
{ concurrency, uploadWindow, downloadWindow, downloadChunkSize, compress, chunkSize, maxRetries, baseRetryDelayMs, maxRetryDelayMs, timeoutMs }.
Sourcepub fn set_callbacks(&self, callbacks: JsValue)
pub fn set_callbacks(&self, callbacks: JsValue)
Install the JS callbacks object (required before any transfer).
Sourcepub fn download_folder(
&self,
base_url: &str,
token: &str,
dir_path: &str,
) -> Promise
pub fn download_folder( &self, base_url: &str, token: &str, dir_path: &str, ) -> Promise
Download every file under the virtual dirPath (empty = root).
Resolves with the number of bytes written.
Sourcepub fn download_file(
&self,
base_url: &str,
token: &str,
file_path: &str,
) -> Promise
pub fn download_file( &self, base_url: &str, token: &str, file_path: &str, ) -> Promise
Download a single file at file_path into the chosen local directory.
Resolves with the number of bytes written.
Sourcepub fn upload(&self, base_url: &str, token: &str) -> Promise
pub fn upload(&self, base_url: &str, token: &str) -> Promise
Upload the files reported by the JS getFileList callback.
Resolves with the number of bytes uploaded.
Sourcepub fn state(&self) -> String
pub fn state(&self) -> String
Current state: idle | downloading | uploading | paused | completed | failed.
Sourcepub fn done_bytes(&self) -> f64
pub fn done_bytes(&self) -> f64
Bytes transferred so far.
Sourcepub fn total_bytes(&self) -> f64
pub fn total_bytes(&self) -> f64
Total bytes to transfer.
Sourcepub fn has_callbacks(&self) -> bool
pub fn has_callbacks(&self) -> bool
Whether callbacks have been installed.
Trait Implementations§
Source§impl From<LibfwClient> for JsValue
impl From<LibfwClient> for JsValue
Source§fn from(value: LibfwClient) -> Self
fn from(value: LibfwClient) -> Self
Source§impl FromWasmAbi for LibfwClient
impl FromWasmAbi for LibfwClient
Source§impl IntoWasmAbi for LibfwClient
impl IntoWasmAbi for LibfwClient
Source§impl LongRefFromWasmAbi for LibfwClient
impl LongRefFromWasmAbi for LibfwClient
Source§type Abi = WasmPtr<WasmRefCell<LibfwClient>>
type Abi = WasmPtr<WasmRefCell<LibfwClient>>
RefFromWasmAbi::AbiSource§type Anchor = RcRef<LibfwClient>
type Anchor = RcRef<LibfwClient>
RefFromWasmAbi::AnchorSource§unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn long_ref_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiSource§impl OptionFromWasmAbi for LibfwClient
impl OptionFromWasmAbi for LibfwClient
Source§impl OptionIntoWasmAbi for LibfwClient
impl OptionIntoWasmAbi for LibfwClient
Source§impl RefFromWasmAbi for LibfwClient
impl RefFromWasmAbi for LibfwClient
Source§type Abi = WasmPtr<WasmRefCell<LibfwClient>>
type Abi = WasmPtr<WasmRefCell<LibfwClient>>
Self are recovered from.Source§type Anchor = RcRef<LibfwClient>
type Anchor = RcRef<LibfwClient>
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for LibfwClient
impl RefMutFromWasmAbi for LibfwClient
Source§type Abi = WasmPtr<WasmRefCell<LibfwClient>>
type Abi = WasmPtr<WasmRefCell<LibfwClient>>
RefFromWasmAbi::AbiSource§type Anchor = RcRefMut<LibfwClient>
type Anchor = RcRefMut<LibfwClient>
RefFromWasmAbi::AnchorSource§unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
unsafe fn ref_mut_from_abi(js: Self::Abi) -> Self::Anchor
RefFromWasmAbi::ref_from_abiimpl SupportsConstructor for LibfwClient
impl SupportsInstanceProperty for LibfwClient
impl SupportsStaticProperty for LibfwClient
Source§impl TryFromJsValue for LibfwClient
impl TryFromJsValue for LibfwClient
Source§impl VectorFromWasmAbi for LibfwClient
impl VectorFromWasmAbi for LibfwClient
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[LibfwClient]>
Source§impl VectorIntoWasmAbi for LibfwClient
impl VectorIntoWasmAbi for LibfwClient
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[LibfwClient]>) -> Self::Abi
Source§impl WasmDescribeVector for LibfwClient
impl WasmDescribeVector for LibfwClient
Auto Trait Implementations§
impl !RefUnwindSafe for LibfwClient
impl !Send for LibfwClient
impl !Sync for LibfwClient
impl !UnwindSafe for LibfwClient
impl Freeze for LibfwClient
impl Unpin for LibfwClient
impl UnsafeUnpin for LibfwClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.