I found myself a bit lost while reading the rust docs, right now I'm unable to find a way to extract A
from actix::Addr<A>
, I also don't know if that is possible or not.
Important part:
pub struct WebsocketManager {
pub clients: Vec<Addr<WebsocketActor>>,
}
impl WebsocketManager {
pub fn send(&self, value: &serde_json::Value, name: &String) {
if self.clients.is_empty() {
return;
}
let string = serde_json::to_string_pretty(value).unwrap();
for client in &self.clients {
// let actor: WebsocketActor = client.get_websocket_actor();
// actor.re.is_match(name) {
// client.do_send(StringMessage(string.clone()));
// }
}
}
}
/// Define http actor
pub struct WebsocketActor {
server: Arc<Mutex<WebsocketManager>>,
pub re: Regex,
}