I passed an atomic reference to the SplitSink from open_connection() -> handle_payload() -> send_heartbeat(). I want to use the sink to send messages but when I try to use the send(&self) method on the sink it gives me this error:
```the method send exists for reference &SplitSink<futures::stream::MapErr<WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, S>, tokio_tungstenite::tungstenite::Message>, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
&SplitSink<futures::stream::MapErr<WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, S>, tokio_tungstenite::tungstenite::Message>: futures::Sink<_>
which is required by &SplitSink<futures::stream::MapErr<WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, S>, tokio_tungstenite::tungstenite::Message>: SinkExt<_>
SplitSink<futures::stream::MapErr<WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, S>, tokio_tungstenite::tungstenite::Message>: futures::Sink<_>
which is required by SplitSink<futures::stream::MapErr<WebSocketStream<tokio_tungstenite::MaybeTlsStream<tokio::net::TcpStream>>, S>, tokio_tungstenite::tungstenite::Message>: SinkExt<_>
Here is the source:
```rs
async fn open_connection(&self) {
//**
let (sink, stream) = ws_stream.split();
let sink_sh = Arc::new(sink); // <-- allows me to call send()
stream.try_for_each(|m| async {
//**
self.handle_payload(payload, &sink_sh).await //<-- passed off
}).await?;
}
async fn handle_payload(&self, payload: Payload, sink: &Arc<Sink<S>>) {
//**
let sh_sink = sink.clone(); //cannot call send()
tokio::spawn(async move {
loop {
interval.tick().await;
send_heartbeat(sh_sink.as_ref()).await; //<-- passed
}
});
I'm assuming it is due to the vague generics causing object slicing, but I'm not sure what to do