down to 3 errors

This commit is contained in:
🪞👃🪞 2025-05-14 14:56:12 +03:00
parent ebdb8881e9
commit 8df49850ae
7 changed files with 84 additions and 81 deletions

View file

@ -1,40 +1,17 @@
use crate::*;
impl<T: Has<Selection>> HasSelection for T {}
impl<T: Has<Option<Selection>>> HasSelection for T {}
pub trait HasSelection: Has<Selection> {
fn selection (&self) -> &Selection {
self.get()
pub trait HasSelection: Has<Option<Selection>> {
fn selection (&self) -> Option<&Selection> {
self.get().as_ref()
}
fn selection_mut (&mut self) -> &mut Selection {
fn selection_mut (&mut self) -> &mut Option<Selection> {
self.get_mut()
}
}
impl Has<Option<Track>> for Arrangement {
fn get (&self) -> &Option<Track> {
let selection: Selection = Has::<Option<Track>>::get(self)?;
let index: Option<usize> = selection.track()?;
let track: Track = Has::<Vec<Track>>::get(self).get(index)?;
}
fn get_mut (&mut self) -> &mut Option<Track> {
Has::<Option<Selection>>::get(self)
.and_then(|selection|selection.track())
.and_then(|index|Has::<Vec<Track>>::get_mut(self).get_mut(index))
}
}
impl Has<Option<Scene>> for Arrangement {
fn get (&self) -> &Option<Scene> {
Has::<Option<Selection>>::get(self)
.and_then(|selection|selection.track())
.and_then(|index|Has::<Vec<Scene>>::get(self).get(index))
}
fn get_mut (&mut self) -> &mut Option<Scene> {
Has::<Option<Selection>>::get(self)
.and_then(|selection|selection.track())
.and_then(|index|Has::<Vec<Scene>>::get_mut(self).get_mut(index).as_deref())
}
impl Arrangement {
}
/// Represents the current user selection in the arranger