INNER CODE UNIT · Rust
Some
aome510/spotify-player · spotify_player/src/client/mod.rs:333
if let Some(conn) = stream_conn.as_ref() {
if let Err(err) = conn.shutdown() {
log::error!("Failed to shutdown old streaming connection: {err:#}");
}
}
*stream_conn = Some(new_conn);
Ok(())
}
/// Pause the integrated streaming client, if a connection exists.
///
/// Returns `true` if a streaming connection was present and the pause
/// command was issued. Used to suppress Spotify's auto-resume of the
/// previous session on startup when `pause_on_startup` is enabled.
#[cfg(feature = "streaming")]
pub fn pause_streaming_on_startup(&self) -> bool {
match self.stream_conn.lock().as_ref() {
Some(spirc) => {