Remapper

Struct Remapper 

Source
pub struct Remapper {
    pub eq_mapping: EqMapping,
    pub instrument_mapping: InstrumentMapping,
    pub table_mapping: TableMapping,
    pub phrase_mapping: PhraseMapping,
    pub chain_mapping: ChainMapping,
}

Fields§

§eq_mapping: EqMapping§instrument_mapping: InstrumentMapping§table_mapping: TableMapping§phrase_mapping: PhraseMapping§chain_mapping: ChainMapping

Implementations§

Source§

impl Remapper

Source

pub fn default_ver(ver: Version) -> Self

Source

pub fn describe<T: RemapperDescriptorBuilder>(&self, builder: &mut T)

Source

pub fn out_chain(&self, chain_id: u8) -> u8

Source

pub fn print(&self) -> String

Source

pub fn create<'a, IT>( from_song: &Song, to_song: &Song, chains: IT, ) -> Result<Remapper, String>
where IT: Iterator<Item = &'a u8>,

Examples found in repository?
examples/read_song.rs (line 26)
15fn run() -> Result<(), Box<dyn Error>> {
16    let args: Vec<String> = env::args().collect();
17
18    let mut ffrom = File::open("./examples/songs/TRACKEQ.m8s")?;
19    let from = Song::read(&mut ffrom)?;
20
21    let mut fto = File::open("./examples/songs/V6EMPTY.m8s")?;
22    let mut to = Song::read(&mut fto)?;
23
24
25    let mut remapper =
26        Remapper::create(&from, &to, vec![0].iter());
27
28    remapper.unwrap().apply(&from, &mut to);
29    // dbg!(&song.eqs);
30
31    Ok(())
32}
Source

pub fn renumber(&self, song: &mut Song)

Same as apply but the same song is the source and destination

Source

pub fn apply(&self, from: &Song, to: &mut Song)

apply the reampping, cannot fail once mapping has been created

Examples found in repository?
examples/read_song.rs (line 28)
15fn run() -> Result<(), Box<dyn Error>> {
16    let args: Vec<String> = env::args().collect();
17
18    let mut ffrom = File::open("./examples/songs/TRACKEQ.m8s")?;
19    let from = Song::read(&mut ffrom)?;
20
21    let mut fto = File::open("./examples/songs/V6EMPTY.m8s")?;
22    let mut to = Song::read(&mut fto)?;
23
24
25    let mut remapper =
26        Remapper::create(&from, &to, vec![0].iter());
27
28    remapper.unwrap().apply(&from, &mut to);
29    // dbg!(&song.eqs);
30
31    Ok(())
32}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.