rename as_boxed_view_ext to into_boxed_view_ext
This commit is contained in:
@@ -225,7 +225,7 @@ impl ListItem for Album {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
||||||
Some(AlbumView::new(queue, library, self).as_boxed_view_ext())
|
Some(AlbumView::new(queue, library, self).into_boxed_view_ext())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn share_url(&self) -> Option<String> {
|
fn share_url(&self) -> Option<String> {
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ impl ListItem for Artist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
||||||
Some(ArtistView::new(queue, library, self).as_boxed_view_ext())
|
Some(ArtistView::new(queue, library, self).into_boxed_view_ext())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn share_url(&self) -> Option<String> {
|
fn share_url(&self) -> Option<String> {
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ impl CommandManager {
|
|||||||
s.call_on_name("main", |v: &mut Layout| {
|
s.call_on_name("main", |v: &mut Layout| {
|
||||||
v.set_screen("search");
|
v.set_screen("search");
|
||||||
if let Some(results) = view {
|
if let Some(results) = view {
|
||||||
v.push_view(results.as_boxed_view_ext())
|
v.push_view(results.into_boxed_view_ext())
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl Library {
|
|||||||
self.playlists()
|
self.playlists()
|
||||||
.iter()
|
.iter()
|
||||||
.find(|local| local.id == remote.id)
|
.find(|local| local.id == remote.id)
|
||||||
.and_then(|local| Some(local.snapshot_id != remote.snapshot_id))
|
.map(|local| local.snapshot_id != remote.snapshot_id)
|
||||||
.unwrap_or(true)
|
.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ impl ListItem for Playlist {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
||||||
Some(PlaylistView::new(queue, library, self).as_boxed_view_ext())
|
Some(PlaylistView::new(queue, library, self).into_boxed_view_ext())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn share_url(&self) -> Option<String> {
|
fn share_url(&self) -> Option<String> {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ impl ListItem for Show {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
fn open(&self, queue: Arc<Queue>, library: Arc<Library>) -> Option<Box<dyn ViewExt>> {
|
||||||
Some(ShowView::new(queue, library, self).as_boxed_view_ext())
|
Some(ShowView::new(queue, library, self).into_boxed_view_ext())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn share_url(&self) -> Option<String> {
|
fn share_url(&self) -> Option<String> {
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ impl ListItem for Track {
|
|||||||
self.artists.join(", "),
|
self.artists.join(", "),
|
||||||
self.title
|
self.title
|
||||||
))
|
))
|
||||||
.as_boxed_view_ext()
|
.into_boxed_view_ext()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ impl<V: ViewExt> ViewExt for NamedView<V> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub trait IntoBoxedViewExt {
|
pub trait IntoBoxedViewExt {
|
||||||
fn as_boxed_view_ext(self) -> Box<dyn ViewExt>;
|
fn into_boxed_view_ext(self) -> Box<dyn ViewExt>;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<V: ViewExt> IntoBoxedViewExt for V {
|
impl<V: ViewExt> IntoBoxedViewExt for V {
|
||||||
fn as_boxed_view_ext(self) -> Box<dyn ViewExt> {
|
fn into_boxed_view_ext(self) -> Box<dyn ViewExt> {
|
||||||
Box::new(self)
|
Box::new(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ impl ViewExt for CoverView {
|
|||||||
GotoMode::Album => {
|
GotoMode::Album => {
|
||||||
if let Some(album) = track.album(queue.clone()) {
|
if let Some(album) = track.album(queue.clone()) {
|
||||||
let view =
|
let view =
|
||||||
AlbumView::new(queue, library, &album).as_boxed_view_ext();
|
AlbumView::new(queue, library, &album).into_boxed_view_ext();
|
||||||
return Ok(CommandResult::View(view));
|
return Ok(CommandResult::View(view));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ impl ViewExt for CoverView {
|
|||||||
// the cover image really doesn't play nice with the menu
|
// the cover image really doesn't play nice with the menu
|
||||||
_ => {
|
_ => {
|
||||||
let view = ArtistView::new(queue, library, &artists[0])
|
let view = ArtistView::new(queue, library, &artists[0])
|
||||||
.as_boxed_view_ext();
|
.into_boxed_view_ext();
|
||||||
Ok(CommandResult::View(view))
|
Ok(CommandResult::View(view))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ impl Layout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let s = id.into();
|
let s = id.into();
|
||||||
self.screens.insert(s.clone(), view.as_boxed_view_ext());
|
self.screens.insert(s.clone(), view.into_boxed_view_ext());
|
||||||
self.stack.insert(s.clone(), Vec::new());
|
self.stack.insert(s.clone(), Vec::new());
|
||||||
self.focus = Some(s);
|
self.focus = Some(s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
|
|||||||
GotoMode::Album => {
|
GotoMode::Album => {
|
||||||
if let Some(album) = item.album(queue.clone()) {
|
if let Some(album) = item.album(queue.clone()) {
|
||||||
let view =
|
let view =
|
||||||
AlbumView::new(queue, library, &album).as_boxed_view_ext();
|
AlbumView::new(queue, library, &album).into_boxed_view_ext();
|
||||||
return Ok(CommandResult::View(view));
|
return Ok(CommandResult::View(view));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -506,7 +506,7 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
|
|||||||
0 => Ok(CommandResult::Consumed(None)),
|
0 => Ok(CommandResult::Consumed(None)),
|
||||||
1 => {
|
1 => {
|
||||||
let view = ArtistView::new(queue, library, &artists[0])
|
let view = ArtistView::new(queue, library, &artists[0])
|
||||||
.as_boxed_view_ext();
|
.into_boxed_view_ext();
|
||||||
Ok(CommandResult::View(view))
|
Ok(CommandResult::View(view))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ impl TabView {
|
|||||||
pub fn add_tab<S: Into<String>, V: IntoBoxedViewExt>(&mut self, id: S, title: S, view: V) {
|
pub fn add_tab<S: Into<String>, V: IntoBoxedViewExt>(&mut self, id: S, title: S, view: V) {
|
||||||
let tab = Tab {
|
let tab = Tab {
|
||||||
title: title.into(),
|
title: title.into(),
|
||||||
view: view.as_boxed_view_ext(),
|
view: view.into_boxed_view_ext(),
|
||||||
};
|
};
|
||||||
self.tabs.push(tab);
|
self.tabs.push(tab);
|
||||||
self.ids.insert(id.into(), self.tabs.len() - 1);
|
self.ids.insert(id.into(), self.tabs.len() - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user