Skip to content

Commit

Permalink
Add config module with two functions in it
Browse files Browse the repository at this point in the history
Fixes: #128
  • Loading branch information
diwic committed Nov 24, 2024
1 parent 85297dc commit e560e9d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
15 changes: 15 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Configuration file API
//!
//! For now, just contains two functions regarding the global configuration
//! stored as a cache inside alsa-lib. Calling `update_free_global` might help
//! against valgrind reporting memory leaks.
use crate::{alsa};
use super::error::*;

pub fn update() -> Result<()> {
acheck!(snd_config_update()).map(|_| ())
}

pub fn update_free_global() -> Result<()> {
acheck!(snd_config_update_free_global()).map(|_| ())
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ pub use crate::hctl::HCtl as HCtl;
pub mod pcm;
pub use crate::pcm::PCM as PCM;

pub mod config;

pub mod rawmidi;
pub use crate::rawmidi::Rawmidi as Rawmidi;

Expand Down
4 changes: 2 additions & 2 deletions src/pcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ impl PCM {
self.verify_format(S::FORMAT).map(|_| IO::new(self))
}

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

0 comments on commit e560e9d

Please sign in to comment.