From df50617c87f262ad0fec580d3017deacf2c07b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 25 Aug 2016 00:08:06 +0300 Subject: [PATCH] Add trait functions for getting back the controller --- src/rsfilesink.rs | 4 ++++ src/rsfilesrc.rs | 4 ++++ src/rshttpsrc.rs | 4 ++++ src/rssink.rs | 2 ++ src/rssource.rs | 2 ++ 5 files changed, 16 insertions(+) diff --git a/src/rsfilesink.rs b/src/rsfilesink.rs index e573073b..999fd3db 100644 --- a/src/rsfilesink.rs +++ b/src/rsfilesink.rs @@ -62,6 +62,10 @@ impl FileSink { } impl Sink for FileSink { + fn get_controller(&self) -> &SinkController { + &self.controller + } + fn set_uri(&self, uri: Option) -> Result<(), (UriError, String)> { let location = &mut self.settings.lock().unwrap().location; diff --git a/src/rsfilesrc.rs b/src/rsfilesrc.rs index 42279323..e065f91b 100644 --- a/src/rsfilesrc.rs +++ b/src/rsfilesrc.rs @@ -63,6 +63,10 @@ impl FileSrc { } impl Source for FileSrc { + fn get_controller(&self) -> &SourceController { + &self.controller + } + fn set_uri(&self, uri: Option) -> Result<(), (UriError, String)> { let location = &mut self.settings.lock().unwrap().location; diff --git a/src/rshttpsrc.rs b/src/rshttpsrc.rs index fd271dec..c7608389 100644 --- a/src/rshttpsrc.rs +++ b/src/rshttpsrc.rs @@ -141,6 +141,10 @@ impl HttpSrc { } impl Source for HttpSrc { + fn get_controller(&self) -> &SourceController { + &self.controller + } + fn set_uri(&self, uri: Option) -> Result<(), (UriError, String)> { let url = &mut self.settings.lock().unwrap().url; diff --git a/src/rssink.rs b/src/rssink.rs index b0a34792..2b9f20df 100644 --- a/src/rssink.rs +++ b/src/rssink.rs @@ -38,6 +38,8 @@ impl SinkController { } pub trait Sink: Sync + Send { + fn get_controller(&self) -> &SinkController; + // Called from any thread at any time fn set_uri(&self, uri: Option) -> Result<(), (UriError, String)>; fn get_uri(&self) -> Option; diff --git a/src/rssource.rs b/src/rssource.rs index ee30861f..ee88ae46 100644 --- a/src/rssource.rs +++ b/src/rssource.rs @@ -37,6 +37,8 @@ impl SourceController { } pub trait Source: Sync + Send { + fn get_controller(&self) -> &SourceController; + // Called from any thread at any time fn set_uri(&self, uri: Option) -> Result<(), (UriError, String)>; fn get_uri(&self) -> Option;