pub struct Client(_);
Expand description

An aria2 websocket rpc client.

The client contains an Arc<InnerClient>) and can be cloned.

Example

use aria2_ws::Client;

#[tokio::main]
async fn main() {
    let client = Client::connect("ws://127.0.0.1:6800/jsonrpc", None)
        .await
        .unwrap();
    let version = client.get_version().await.unwrap();
    println!("{:?}", version);
}

Implementations

Create a new Client that connects to the given url.

Example
use aria2_ws::Client;

#[tokio::main]
async fn main() {
    let client = Client::connect("ws://127.0.0.1:6800/jsonrpc", None)
        .await
        .unwrap();
    let gid = client
        .add_uri(
            vec!["https://go.dev/dl/go1.17.6.windows-amd64.msi".to_string()],
            None,
            None,
            None,
        )
        .await
        .unwrap();
    client.force_remove(gid).await.unwrap();
}

Call aria2 with the given method and params, and return the result in timeout.

If the timeout is None, the default timeout will be used.

If the timeout is zero, there will be no timeout.

Set hook for task with given gid.

Returns

This method returns a list which contains two integers.

The first integer is the number of URIs deleted. The second integer is the number of URIs added.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.