Struct binance::userstream::UserStream
source · [−]pub struct UserStream {
pub client: Client,
pub recv_window: u64,
}Fields
client: Clientrecv_window: u64Implementations
sourceimpl UserStream
impl UserStream
sourcepub async fn start(&self) -> Result<UserDataStream>
pub async fn start(&self) -> Result<UserDataStream>
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)sourcepub async fn keep_alive(&self, listen_key: &str) -> Result<Success>
pub async fn keep_alive(&self, listen_key: &str) -> Result<Success>
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())sourcepub async fn close(&self, listen_key: &str) -> Result<Success>
pub async fn close(&self, listen_key: &str) -> Result<Success>
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
sourceimpl Binance for UserStream
impl Binance for UserStream
fn new_with_config(
api_key: Option<String>,
secret_key: Option<String>,
config: &Config
) -> UserStream
fn new(api_key: Option<String>, secret_key: Option<String>) -> Self
sourcefn new_with_env(config: &Config) -> Self
fn new_with_env(config: &Config) -> Self
Create a binance API using environment variables for credentials
BINANCE_API_KEY=
BINANCE_API_SECRET_KEY= Read more
sourceimpl Clone for UserStream
impl Clone for UserStream
sourcefn clone(&self) -> UserStream
fn clone(&self) -> UserStream
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations
impl !RefUnwindSafe for UserStream
impl Send for UserStream
impl Sync for UserStream
impl Unpin for UserStream
impl !UnwindSafe for UserStream
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more