video: fix VideoFormat Display implementation

We were calling the blanket implementation of ToString, which is using
Display, rather than our own, resulting in an infinite recursion.

Fix #208
This commit is contained in:
Guillaume Desmottes 2019-06-18 15:45:33 +05:30
parent 856a5a25e8
commit af65497c39

View file

@ -116,6 +116,18 @@ impl str::FromStr for ::VideoFormat {
impl fmt::Display for ::VideoFormat { impl fmt::Display for ::VideoFormat {
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
f.write_str(self.to_string().as_str()) f.write_str(::VideoFormat::to_string(*self))
}
}
#[cfg(test)]
mod tests {
use gst;
#[test]
fn test_display() {
gst::init().unwrap();
format!("{}", ::VideoFormat::Nv16);
} }
} }