1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use std::borrow::Cow;
use std::error::Error;
use std::ffi::CStr;
use std::fmt;
#[derive(Debug)]
pub struct GetFrameError<'a>(Cow<'a, CStr>);
impl<'a> fmt::Display for GetFrameError<'a> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.0.to_string_lossy())
}
}
impl<'a> Error for GetFrameError<'a> {
#[inline]
fn description(&self) -> &str {
"VapourSynth error"
}
}
impl<'a> GetFrameError<'a> {
#[inline]
pub(crate) fn new(message: Cow<'a, CStr>) -> Self {
GetFrameError(message)
}
#[inline]
pub fn into_inner(self) -> Cow<'a, CStr> {
self.0
}
}