use crate::data::Data;
use crate::errors::TramexError;
use crate::interface::interface_file::file_handler::File;
use crate::interface::layer::Layers;
#[cfg(feature = "websocket")]
use crate::interface::websocket::ws_connection::WsConnection;
pub enum Interface {
#[cfg(feature = "websocket")]
Ws(WsConnection),
File(File),
}
pub trait InterfaceTrait {
fn get_more_data(&mut self, _layer_list: Layers, data: &mut Data) -> Result<(), Vec<TramexError>>;
fn close(&mut self) -> Result<(), TramexError>;
}
impl core::fmt::Debug for Interface {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.debug_struct("Interface")
.field(
"field",
match self {
#[cfg(feature = "websocket")]
Interface::Ws(ws) => ws,
Interface::File(file) => file,
},
)
.finish()
}
}