1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use std::fmt;

/// Websocket stream.
///
/// The `Stream` trait is a simplified interface for Binance approved
/// websocket streams.
pub struct Stream {
    stream_name: String,
}

impl Stream {
    pub fn new(stream_name: &str) -> Self {
        Self {
            stream_name: stream_name.to_owned(),
        }
    }

    pub fn as_str(&self) -> &str {
        &self.stream_name
    }
}

impl fmt::Display for Stream {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.stream_name)
    }
}