From 79aed6691454bf49d653b082741edd1d04fb3dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sun, 15 May 2016 11:55:52 +0300 Subject: [PATCH] Require Sync and Send traits to be implemented for Sources --- src/rsfilesrc.rs | 3 +++ src/rshttpsrc.rs | 3 +++ src/rssource.rs | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rsfilesrc.rs b/src/rsfilesrc.rs index 9cb744a5..01766f91 100644 --- a/src/rsfilesrc.rs +++ b/src/rsfilesrc.rs @@ -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 } diff --git a/src/rshttpsrc.rs b/src/rshttpsrc.rs index 3b2add3d..332ef76b 100644 --- a/src/rshttpsrc.rs +++ b/src/rshttpsrc.rs @@ -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 } diff --git a/src/rssource.rs b/src/rssource.rs index 1aac363e..a6bcbbe0 100644 --- a/src/rssource.rs +++ b/src/rssource.rs @@ -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) -> bool; fn get_uri(&self) -> Option; fn is_seekable(&self) -> bool;