mirror of
https://github.com/RustAudio/rodio
synced 2025-03-04 15:07:18 +00:00
Add #[inline] attributes
This commit is contained in:
parent
6feffedcc4
commit
eb391dd089
3 changed files with 7 additions and 0 deletions
|
@ -163,6 +163,7 @@ impl<I> ChannelsCountConverter<I> where I: Iterator {
|
|||
///
|
||||
/// Panicks if `from` or `to` are equal to 0.
|
||||
///
|
||||
#[inline]
|
||||
pub fn new(input: I, from: cpal::ChannelsCount, to: cpal::ChannelsCount)
|
||||
-> ChannelsCountConverter<I>
|
||||
{
|
||||
|
@ -211,6 +212,7 @@ impl<I> Iterator for ChannelsCountConverter<I> where I: Iterator, I::Item: Clone
|
|||
Some(self.output_buffer.remove(0))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let (min, max) = self.input.size_hint();
|
||||
|
||||
|
@ -250,6 +252,7 @@ impl<I> SamplesRateConverter<I> where I: Iterator {
|
|||
///
|
||||
/// Panicks if `from` or `to` are equal to 0.
|
||||
///
|
||||
#[inline]
|
||||
pub fn new(mut input: I, from: cpal::SamplesRate, to: cpal::SamplesRate)
|
||||
-> SamplesRateConverter<I>
|
||||
{
|
||||
|
@ -329,6 +332,7 @@ impl<I> Iterator for SamplesRateConverter<I> where I: Iterator, I::Item: Sample
|
|||
Some(result)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
let (min, max) = self.input.size_hint();
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ pub struct Handle<'a> {
|
|||
}
|
||||
|
||||
impl<'a> Handle<'a> {
|
||||
#[inline]
|
||||
pub fn stop(self) {
|
||||
let commands = self.engine.commands.lock().unwrap();
|
||||
commands.send(Command::Stop(self.id)).unwrap();
|
||||
|
|
|
@ -23,12 +23,14 @@ pub struct Handle(engine::Handle<'static>);
|
|||
|
||||
impl Handle {
|
||||
/// Stops the sound.
|
||||
#[inline]
|
||||
pub fn stop(self) {
|
||||
self.0.stop()
|
||||
}
|
||||
}
|
||||
|
||||
/// Plays a sound once. Returns a `Handle` that can be used to control the sound.
|
||||
#[inline]
|
||||
pub fn play_once<R>(endpoint: &Endpoint, input: R) -> Handle
|
||||
where R: Read + Seek + Send + 'static
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue