format/context/input: add seek() method

This commit is contained in:
lummax
2015-10-14 16:22:28 +02:00
committed by meh
parent ef3f821c6f
commit a736c8b438
3 changed files with 49 additions and 0 deletions

View File

@ -10,6 +10,7 @@ pub mod chroma;
pub mod time;
pub mod channel_layout;
pub mod option;
pub mod range;
use std::ffi::CStr;
use std::str::from_utf8_unchecked;

35
src/util/range.rs Normal file
View File

@ -0,0 +1,35 @@
use std::ops;
pub trait Range<T> {
fn start(&self) -> Option<&T> {
None
}
fn end(&self) -> Option<&T> {
None
}
}
impl<T> Range<T> for ops::Range<T> {
fn start(&self) -> Option<&T> {
Some(&self.start)
}
fn end(&self) -> Option<&T> {
Some(&self.end)
}
}
impl<T> Range<T> for ops::RangeTo<T> {
fn end(&self) -> Option<&T> {
Some(&self.end)
}
}
impl<T> Range<T> for ops::RangeFrom<T> {
fn start(&self) -> Option<&T> {
Some(&self.start)
}
}
impl<T> Range<T> for ops::RangeFull { }