Remove the get_ prefix of methods (#151)

* Remove the `get_` prefix of methods

* Fix overlooks
This commit is contained in:
tomaka 2017-10-11 10:39:44 +02:00 • committed by GitHub
parent 35d9201b85
commit cdcef96279
4 changed files with 48 additions and 10 deletions

View file

@ -14,18 +14,26 @@ pub enum SampleFormat {
impl SampleFormat {
/// Returns the size in bytes of a sample of this format.
#[inline]
pub fn get_sample_size(&self) -> usize {
pub fn sample_size(&self) -> usize {
match self {
&SampleFormat::I16 => mem::size_of::<i16>(),
&SampleFormat::U16 => mem::size_of::<u16>(),
&SampleFormat::F32 => mem::size_of::<f32>(),
}
}
/// Deprecated. Use `sample_size` instead.
#[inline]
#[deprecated]
pub fn get_sample_size(&self) -> usize {
self.sample_size()
}
}
/// Trait for containers that contain PCM data.
pub unsafe trait Sample: Copy + Clone {
/// Returns the `SampleFormat` corresponding to this data type.
// TODO: rename to `format()`. Requires a breaking change.
fn get_format() -> SampleFormat;
}