Hammond-gtk: Use Atomic Refference counting to reduce cloning of Podcast.

This commit is contained in:
Jordan Petridis
2018-02-07 06:28:16 +02:00
parent df02054b29
commit 67af85e347
5 changed files with 45 additions and 26 deletions
+12
View File
@@ -5,6 +5,8 @@ use errors::DataError;
use models::{Save, Source};
use schema::podcast;
use std::sync::Arc;
#[derive(Queryable, Identifiable, AsChangeset, Associations, PartialEq)]
#[belongs_to(Source, foreign_key = "source_id")]
#[changeset_options(treat_none_as_null = "true")]
@@ -138,6 +140,16 @@ impl From<Podcast> for PodcastCoverQuery {
}
}
impl From<Arc<Podcast>> for PodcastCoverQuery {
fn from(p: Arc<Podcast>) -> PodcastCoverQuery {
PodcastCoverQuery {
id: p.id(),
title: p.title.clone(),
image_uri: p.image_uri.clone(),
}
}
}
impl PodcastCoverQuery {
/// Get the Feed `id`.
pub fn id(&self) -> i32 {