From 7b39c8e6dc69867a1eb712ef5bd75a61f0db1c64 Mon Sep 17 00:00:00 2001 From: p6nj Date: Fri, 5 Jul 2024 12:47:23 +0200 Subject: [PATCH] rename into Into --- bingus/src/lib.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bingus/src/lib.rs b/bingus/src/lib.rs index 40b6b78..51ab99d 100644 --- a/bingus/src/lib.rs +++ b/bingus/src/lib.rs @@ -1,40 +1,40 @@ use dasp_sample::{FromSample, Sample, U24, U48}; -pub trait AsSample +pub trait IntoSample where Self: Sized, { fn _prepare(self) -> F; - fn as_sample>(self) -> S { + fn into_sample>(self) -> S { Sample::from_sample(self._prepare()) } } -impl AsSample for u8 { +impl IntoSample for u8 { fn _prepare(self) -> u8 { self } } -impl AsSample for [u8; 2] { +impl IntoSample for [u8; 2] { fn _prepare(self) -> u16 { ((self[0]._prepare() as u16) << 8) | self[1] as u16 } } -impl AsSample for [u8; 3] { +impl IntoSample for [u8; 3] { fn _prepare(self) -> U24 { (U24::from([self[0], self[1]]._prepare()) << 8.into()) | U24::from(self[2]) } } -impl AsSample for [u8; 4] { +impl IntoSample for [u8; 4] { fn _prepare(self) -> u32 { (([self[0], self[1], self[2]]._prepare().inner() as u32) << 8) | self[3] as u32 } } -impl AsSample for [u8; 6] { +impl IntoSample for [u8; 6] { fn _prepare(self) -> U48 { ((U48::from([self[0], self[1], self[2], self[3]]._prepare()) << 16u8.into()) | (U48::from(self[4]) << 8u8.into()))