mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer-rs.git
synced 2025-09-01 17:33:50 +00:00
Add #[must_use] annotation to all iterator structs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/1690>
This commit is contained in:
parent
de65180c15
commit
493175742f
16 changed files with 22 additions and 0 deletions
|
@ -133,6 +133,7 @@ impl AnalyticsMtdRef<'_, AnalyticsClassificationMtd> {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct AnalyticsClassificationIterator<'a> {
|
||||
mtd: &'a AnalyticsMtdRef<'a, AnalyticsClassificationMtd>,
|
||||
index: usize,
|
||||
|
|
|
@ -468,6 +468,7 @@ impl<'a, T: AnalyticsMtd> AsRef<AnalyticsMtdRef<'a, T>> for AnalyticsMtdRefMut<'
|
|||
|
||||
macro_rules! define_mtd_iter {
|
||||
($name:ident, $metaref:ty, $itemref:ty, $copy_meta:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct $name<'a, T: AnalyticsMtd> {
|
||||
meta: $metaref,
|
||||
state: glib::ffi::gpointer,
|
||||
|
|
|
@ -225,6 +225,7 @@ pub const AUDIO_FORMAT_F32: crate::AudioFormat = crate::AudioFormat::F32le;
|
|||
#[cfg(target_endian = "little")]
|
||||
pub const AUDIO_FORMAT_F64: crate::AudioFormat = crate::AudioFormat::F64le;
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct AudioFormatIterator {
|
||||
idx: usize,
|
||||
len: usize,
|
||||
|
|
|
@ -3,6 +3,7 @@ use std::fmt;
|
|||
|
||||
use crate::{prelude::*, DiscovererStreamInfo};
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct Iter {
|
||||
stream_info: Option<DiscovererStreamInfo>,
|
||||
|
|
|
@ -651,6 +651,7 @@ impl ToOwned for SDPMediaRef {
|
|||
|
||||
macro_rules! define_iter(
|
||||
($name:ident, $typ:ty, $get_item:expr, $get_len:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct $name<'a> {
|
||||
media: &'a SDPMediaRef,
|
||||
|
|
|
@ -1007,6 +1007,7 @@ impl glib::value::ToValueOptional for SDPMessageRef {
|
|||
|
||||
macro_rules! define_iter(
|
||||
($name:ident, $typ:ty, $get_item:expr, $get_len:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct $name<'a> {
|
||||
message: &'a SDPMessageRef,
|
||||
|
@ -1103,6 +1104,7 @@ macro_rules! define_iter(
|
|||
|
||||
macro_rules! define_iter_mut(
|
||||
($name:ident, $typ:ty, $get_item:expr, $get_len:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct $name<'a> {
|
||||
message: &'a mut SDPMessageRef,
|
||||
|
|
|
@ -336,6 +336,7 @@ impl Ord for crate::VideoFormat {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct VideoFormatIterator {
|
||||
idx: usize,
|
||||
len: usize,
|
||||
|
|
|
@ -415,6 +415,7 @@ impl VideoRegionOfInterestMeta {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct ParamsIter<'a> {
|
||||
_meta: &'a VideoRegionOfInterestMeta,
|
||||
list: Option<ptr::NonNull<glib::ffi::GList>>,
|
||||
|
|
|
@ -454,6 +454,7 @@ impl<'a> std::iter::FromIterator<&'a VideoOverlayRectangle> for VideoOverlayComp
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct Iter<'a> {
|
||||
composition: &'a VideoOverlayCompositionRef,
|
||||
idx: usize,
|
||||
|
|
|
@ -152,6 +152,7 @@ impl<'a> TryFrom<&'a crate::VideoInfo> for VideoVBIParser {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct AncillaryIter<'a> {
|
||||
parser: &'a mut VideoVBIParser,
|
||||
|
|
|
@ -873,6 +873,7 @@ impl BufferRef {
|
|||
|
||||
macro_rules! define_meta_iter(
|
||||
($name:ident, $typ:ty, $mtyp:ty, $prepare_buffer:expr, $from_ptr:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct $name<'a, T: MetaAPI + 'a> {
|
||||
buffer: $typ,
|
||||
state: glib::ffi::gpointer,
|
||||
|
@ -1331,6 +1332,7 @@ pub struct Dump<'a> {
|
|||
end: Bound<usize>,
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
struct BufferChunked16Iter<'a> {
|
||||
buffer: &'a BufferRef,
|
||||
mem_idx: usize,
|
||||
|
|
|
@ -320,6 +320,7 @@ impl Bus {
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct Iter<'a> {
|
||||
bus: &'a Bus,
|
||||
|
|
|
@ -694,6 +694,7 @@ impl<T: StaticType> glib::translate::FromGlibPtrFull<*mut ffi::GstIterator> for
|
|||
}
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
pub struct StdIterator<T> {
|
||||
inner: Iterator<T>,
|
||||
error: Option<IteratorError>,
|
||||
|
|
|
@ -1780,6 +1780,7 @@ crate::utils::define_fixed_size_iter!(
|
|||
}
|
||||
);
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct Iter<'a> {
|
||||
iter: FieldIterator<'a>,
|
||||
|
@ -1844,6 +1845,7 @@ impl ExactSizeIterator for Iter<'_> {}
|
|||
impl std::iter::FusedIterator for Iter<'_> {}
|
||||
|
||||
#[cfg(feature = "v1_26")]
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct IdIter<'a> {
|
||||
iter: FieldIdIterator<'a>,
|
||||
|
|
|
@ -635,6 +635,7 @@ impl PartialEq for TagListRef {
|
|||
|
||||
impl Eq for TagListRef {}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct TagIter<'a, T: Tag<'a>> {
|
||||
taglist: &'a TagListRef,
|
||||
|
@ -743,6 +744,7 @@ where
|
|||
{
|
||||
}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct GenericTagIter<'a> {
|
||||
taglist: &'a TagListRef,
|
||||
|
@ -837,6 +839,7 @@ impl ExactSizeIterator for GenericTagIter<'_> {}
|
|||
|
||||
impl std::iter::FusedIterator for GenericTagIter<'_> {}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct GenericIter<'a> {
|
||||
taglist: &'a TagListRef,
|
||||
|
@ -931,6 +934,7 @@ impl ExactSizeIterator for GenericIter<'_> {}
|
|||
|
||||
impl std::iter::FusedIterator for GenericIter<'_> {}
|
||||
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct Iter<'a> {
|
||||
taglist: &'a TagListRef,
|
||||
|
|
|
@ -81,6 +81,7 @@ where
|
|||
|
||||
macro_rules! define_fixed_size_iter(
|
||||
($name:ident, $typ:ty, $ityp:ty, $get_len:expr, $get_item:expr) => {
|
||||
#[must_use = "iterators are lazy and do nothing unless consumed"]
|
||||
#[derive(Debug)]
|
||||
pub struct $name<'a> {
|
||||
pub(crate) collection: $typ,
|
||||
|
|
Loading…
Reference in a new issue