Skip to content

Commit e560e9d

Browse files
committed
Add config module with two functions in it
Fixes: #128
1 parent 85297dc commit e560e9d

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/config.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//! Configuration file API
2+
//!
3+
//! For now, just contains two functions regarding the global configuration
4+
//! stored as a cache inside alsa-lib. Calling `update_free_global` might help
5+
//! against valgrind reporting memory leaks.
6+
use crate::{alsa};
7+
use super::error::*;
8+
9+
pub fn update() -> Result<()> {
10+
acheck!(snd_config_update()).map(|_| ())
11+
}
12+
13+
pub fn update_free_global() -> Result<()> {
14+
acheck!(snd_config_update_free_global()).map(|_| ())
15+
}

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ pub use crate::hctl::HCtl as HCtl;
110110
pub mod pcm;
111111
pub use crate::pcm::PCM as PCM;
112112

113+
pub mod config;
114+
113115
pub mod rawmidi;
114116
pub use crate::rawmidi::Rawmidi as Rawmidi;
115117

src/pcm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ impl PCM {
239239
self.verify_format(S::FORMAT).map(|_| IO::new(self))
240240
}
241241

242-
/// Creates IO without checking [`S`] is valid type.
242+
/// Creates IO without checking `S` is valid type.
243243
///
244-
/// SAFETY: Caller must guarantee [`S`] is valid type for this PCM stream
244+
/// SAFETY: Caller must guarantee `S` is valid type for this PCM stream
245245
/// and that no other IO objects exist at the same time for the same stream
246246
/// (or in some other way guarantee mmap safety)
247247
pub unsafe fn io_unchecked<S: IoFormat>(&self) -> IO<S> {

0 commit comments

Comments
 (0)