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