Struct aria2_ws::Client

source ·
pub struct Client { /* private fields */ }
Expand description

An aria2 websocket rpc client.

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();
}

Methods from Deref<Target = InnerClient>

Send a rpc request to websocket without waiting for response.

Send a rpc request to websocket and wait for corresponding response.

Subscribe to notifications.

Returns a instance of broadcast::Receiver which can be used to receive notifications.

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
The resulting type after dereferencing.
Dereferences the value.

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
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.