Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sdl2/mixer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,12 @@ impl Chunk {
Self::from_owned_raw(raw)
}

/// Load from `RWOps` for use as a sample.
pub fn from_rwops(rwops: RWops) -> Result<Chunk, String> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn from_rwops(rwops: RWops) -> Result<Chunk, String> {
pub fn from_rwops(rwops: RWops<'_>) -> Result<Chunk, String> {

I prefer to not hide lifetimes, just to have it clear on the function signature that RWops has a lifetime

let raw = unsafe { mixer::Mix_LoadWAV_RW(rwops.raw(), 0) };
Self::from_owned_raw(raw)
}

/// Load chunk from a buffer containing raw audio data in the mixer format. The length of the
/// buffer has to fit in 32-bit unsigned integer. The chunk takes ownership of the buffer.
///
Expand Down
Loading