gstreamer-rs/gstreamer/src/iterator.rs

48 lines
1.1 KiB
Rust
Raw Normal View History

2017-07-29 13:37:06 +00:00
// This file was generated by gir (a01311c+) from gir-files (???)
// DO NOT EDIT
use ffi;
use glib::translate::*;
use glib_ffi;
use gobject_ffi;
use std::mem;
use std::ptr;
use glib::Value;
use IteratorResult;
glib_wrapper! {
pub struct Iterator(Boxed<ffi::GstIterator>);
match fn {
copy => |ptr| ffi::gst_iterator_copy(mut_override(ptr)),
free => |ptr| ffi::gst_iterator_free(ptr),
get_type => || ffi::gst_iterator_get_type(),
}
}
impl Iterator {
#[cfg_attr(feature = "cargo-clippy", allow(should_implement_trait))]
2017-07-29 13:37:06 +00:00
pub fn next(&mut self) -> Result<Value, IteratorResult> {
unsafe {
let mut value = Value::uninitialized();
let res = from_glib(ffi::gst_iterator_next(
self.to_glib_none_mut().0,
value.to_glib_none_mut().0,
));
2017-07-29 13:37:06 +00:00
if res == IteratorResult::Ok {
Ok(value)
} else {
Err(res)
}
}
}
pub fn resync(&mut self) {
unsafe {
ffi::gst_iterator_resync(self.to_glib_none_mut().0);
}
}
}
unsafe impl Send for Iterator {}