fn subscribe(channel: &str) -> Option<String> {
    REQUEST_SENDER.with(|cell| {
        if let Some(chan) = cell.borrow_mut().as_ref() {
            chan.try_send(PubSubRequest::Subscribe(channel.to_owned()))
                .err()
                .map(|e| e.to_string())
        } else {
            Some("Not connected".to_owned())
        }
    })
}
// It's lame as hell to use strings as errors, but I don't feel like
// making a whole new type encompassing possible errors, since we're returning a string
// to BYOND anyway.
It's lame as hell to use strings as errors, but I don't feel like
making a whole new type encompassing possible errors, since we're returning a string
to BYOND anyway.
It ' s lame as hell to use strings as errors but I don ' t feel like making a whole new type encompassing possible errors since we ' re returning a string to BYOND anyway .
fn subscribe(channel: &str) -> Option<String> {
    REQUEST_SENDER.with(|cell| {
        if let Some(chan) = cell.borrow_mut().as_ref() {
            chan.try_send(PubSubRequest::Subscribe(channel.to_owned()))
                .err()
                .map(|e| e.to_string())
        } else {
            Some("Not connected".to_owned())
        }
    })
}
fn subscribe ( channel : & str ) -> Option < String > { REQUEST_SENDER . with ( | cell | { if let Some ( chan ) = cell . borrow_mut ( ) . as_ref ( ) { chan . try_send ( PubSubRequest :: Subscribe ( channel . to_owned ( ) ) ) . err ( ) . map ( | e | e . to_string ( ) ) } else { Some ( " " . to_owned ( ) ) } } ) }
It's lame as hell to use strings as errors, but I don't feel like
making a whole new type encompassing possible errors, since we're returning a string
to BYOND anyway.
It ' s lame as hell to use strings as errors but I don ' t feel like making a whole new type encompassing possible errors since we ' re returning a string to BYOND anyway .
channel
&str
channel
&str