2018-03-29 17:40:56 -04:00
|
|
|
use std::{
|
|
|
|
marker::Sized,
|
|
|
|
fmt::Debug
|
|
|
|
};
|
|
|
|
|
2018-03-23 17:24:06 -04:00
|
|
|
use models::{Payload, OpCode};
|
2018-03-29 17:40:56 -04:00
|
|
|
use error::Result;
|
|
|
|
|
2018-03-22 17:54:49 -04:00
|
|
|
|
|
|
|
pub trait Connection
|
|
|
|
where Self: Sized
|
|
|
|
{
|
|
|
|
fn connect() -> Result<Self>;
|
|
|
|
|
2018-03-23 17:24:06 -04:00
|
|
|
fn send<T>(&mut self, opcode: OpCode, payload: T) -> Result<()>
|
2018-03-22 17:54:49 -04:00
|
|
|
where T: Payload + Debug;
|
|
|
|
|
|
|
|
fn recv(&mut self) -> Result<Vec<u8>>;
|
|
|
|
}
|