rspotify 0.16.0

Spotify API wrapper
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#[derive(Debug, Default)]
pub struct Mutex<T: ?Sized>(futures::lock::Mutex<T>);

#[derive(Debug)]
pub struct LockError;

impl<T> Mutex<T> {
    pub fn new(val: T) -> Self {
        Self(futures::lock::Mutex::new(val))
    }

    pub async fn lock(&self) -> Result<futures::lock::MutexGuard<'_, T>, LockError> {
        let val = self.0.lock().await;
        Ok(val)
    }
}