Fix no_std build

Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
John Nunley 2024-01-27 12:01:15 -08:00
parent 7beb87ae9f
commit 6f0750c523
No known key found for this signature in database
GPG Key ID: 2FE69973CFD64832
2 changed files with 5 additions and 6 deletions

View File

@ -240,11 +240,10 @@ impl<T> List<T> {
queue: concurrent_queue::ConcurrentQueue::unbounded(),
}
}
pub fn total_listeners(&self) -> Result<usize, &str> {
self.inner
.try_lock()
.map(|lock| Ok(lock.listeners.len()))
.unwrap_or(Err("<locked>"))
/// Try to get the total number of listeners without blocking.
pub(super) fn try_total_listeners(&self) -> Option<usize> {
self.inner.try_lock().map(|lock| lock.listeners.len())
}
}

View File

@ -46,7 +46,7 @@ impl<T> List<T> {
}
/// Get the total number of listeners without blocking.
pub fn try_total_listeners(&self) -> Option<usize> {
pub(crate) fn try_total_listeners(&self) -> Option<usize> {
self.0.try_lock().ok().map(|list| list.len)
}