Require Sync and Send traits to be implemented for Sources

This commit is contained in:
Sebastian Dröge 2016-05-15 11:55:52 +03:00
parent 846f4775d9
commit 79aed66914
3 changed files with 7 additions and 1 deletions

View file

@ -16,6 +16,9 @@ pub struct FileSrc {
position: u64,
}
unsafe impl Sync for FileSrc {}
unsafe impl Send for FileSrc {}
impl FileSrc {
fn new() -> FileSrc {
FileSrc { location: None, file: None, position: 0 }

View file

@ -22,6 +22,9 @@ pub struct HttpSrc {
stop: u64,
}
unsafe impl Sync for HttpSrc {}
unsafe impl Send for HttpSrc {}
impl HttpSrc {
fn new() -> HttpSrc {
HttpSrc { url: None, client: Client::new(), response: None, seekable: false, position: 0, size: u64::MAX, start: 0, stop: u64::MAX }

View file

@ -5,7 +5,7 @@ use std::ptr;
use utils::*;
pub trait Source {
pub trait Source: Sync + Send {
fn set_uri(&mut self, uri_str: &Option<String>) -> bool;
fn get_uri(&self) -> Option<String>;
fn is_seekable(&self) -> bool;