Struct binance::userstream::UserStream[][src]

pub struct UserStream {
    pub client: Client,
    pub recv_window: u64,
}

Fields

client: Clientrecv_window: u64

Implementations

Get a listen key for the stream

Examples

use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
assert!(start.unwrap().listen_key.len() > 0)

Keep the connection alive, as the listen key becomes invalid after 60mn

Examples

use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
let keep_alive = tokio_test::block_on(userstream.keep_alive(&start.unwrap().listen_key));
assert!(keep_alive.is_ok())

Invalidate the listen key

Examples

use binance::{api::*, userstream::*, config::*};
let userstream: UserStream = Binance::new_with_env(&Config::testnet());
let start = tokio_test::block_on(userstream.start());
assert!(start.is_ok(), "{:?}", start);
let close = tokio_test::block_on(userstream.close(&start.unwrap().listen_key));
assert!(close.is_ok())

Trait Implementations

Create a binance API using environment variables for credentials BINANCE_API_KEY= BINANCE_API_SECRET_KEY= Read more

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

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)

recently added

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.