FfmpegIterator

Struct FfmpegIterator 

Source
pub struct FfmpegIterator { /* private fields */ }
Expand description

An iterator over events from an ffmpeg process, including parsed metadata, progress, and raw video frames.

Implementations§

Source§

impl FfmpegIterator

Source

pub fn new(child: &mut FfmpegChild) -> Result<Self>

Source

pub fn collect_metadata(&mut self) -> Result<FfmpegMetadata>

Advance the iterator until all metadata has been collected, returning it.

Source

pub fn filter_errors(self) -> impl Iterator<Item = String>

Returns an iterator over error messages (FfmpegEvent::Error and FfmpegEvent::LogError).

Source

pub fn filter_progress(self) -> impl Iterator<Item = FfmpegProgress>

Filter out all events except for progress (FfmpegEvent::Progress).

Examples found in repository?
examples/progress.rs (line 22)
9fn main() {
10  let fps = 60;
11  let duration = 10;
12  let total_frames = fps * duration;
13  let arg_string = format!(
14    "-f lavfi -i testsrc=duration={duration}:size=1920x1080:rate={fps} -y output/test.mp4"
15  );
16  FfmpegCommand::new()
17    .args(arg_string.split(' '))
18    .spawn()
19    .unwrap()
20    .iter()
21    .unwrap()
22    .filter_progress()
23    .for_each(|progress| println!("{}%", (progress.frame * 100) / total_frames));
24}
Source

pub fn filter_frames(self) -> impl Iterator<Item = OutputVideoFrame>

Filter out all events except for output frames (FfmpegEvent::OutputFrame).

Examples found in repository?
examples/hello_world.rs (line 17)
8fn main() -> anyhow::Result<()> {
9  // Run an FFmpeg command that generates a test video
10  let iter = FfmpegCommand::new() // <- Builder API like `std::process::Command`
11    .testsrc()  // <- Discoverable aliases for FFmpeg args
12    .rawvideo() // <- Convenient argument presets
13    .spawn()?   // <- Ordinary `std::process::Child`
14    .iter()?;   // <- Blocking iterator over logs and output
15
16  // Use a regular "for" loop to read decoded video data
17  for frame in iter.filter_frames() {
18    println!("frame: {}x{}", frame.width, frame.height);
19    let _pixels: Vec<u8> = frame.data; // <- raw RGB pixels! 🎨
20  }
21
22  Ok(())
23}
More examples
Hide additional examples
examples/terminal_video.rs (line 19)
9fn main() -> Result<()> {
10  let iter = FfmpegCommand::new()
11    .format("lavfi")
12    .arg("-re") // "realtime"
13    .input(format!(
14      "testsrc=size={OUTPUT_WIDTH}x{OUTPUT_HEIGHT}:rate={OUTPUT_FRAMERATE}"
15    ))
16    .rawvideo()
17    .spawn()?
18    .iter()?
19    .filter_frames();
20
21  for frame in iter {
22    // clear the previous frame
23    if frame.frame_num > 0 {
24      for _ in 0..frame.height {
25        print!("\x1B[{}A", 1);
26      }
27    }
28
29    // Print the pixels colored with ANSI codes
30    for y in 0..frame.height {
31      for x in 0..frame.width {
32        let idx = (y * frame.width + x) as usize * 3;
33        let r = frame.data[idx] as u32;
34        let g = frame.data[idx + 1] as u32;
35        let b = frame.data[idx + 2] as u32;
36        print!("\x1B[48;2;{r};{g};{b}m ");
37      }
38      println!("\x1B[0m");
39    }
40  }
41
42  Ok(())
43}
examples/h265_transcode.rs (line 32)
16fn main() {
17  // Create an H265 source video as a starting point
18  let input_path = "output/h265.mp4";
19  if !Path::new(input_path).exists() {
20    create_h265_source(input_path);
21  }
22
23  // One instance decodes H265 to raw frames
24  let mut input = FfmpegCommand::new()
25    .input(input_path)
26    .rawvideo()
27    .spawn()
28    .unwrap();
29
30  // Frames can be transformed by Iterator `.map()`.
31  // This example is a no-op, with frames passed through unaltered.
32  let transformed_frames = input.iter().unwrap().filter_frames();
33
34  // You could easily add some "middleware" processing here:
35  // - overlay or composite another RGB image (or even another Ffmpeg Iterator)
36  // - apply a filter like blur or convolution
37  // Note: some of these operations are also possible with FFmpeg's (somewhat arcane)
38  // `filtergraph` API, but doing it in Rust gives you much finer-grained
39  // control, debuggability, and modularity -- you can pull in any Rust crate
40  // you need.
41
42  // A second instance encodes the updated frames back to H265
43  let mut output = FfmpegCommand::new()
44    .args([
45      "-f", "rawvideo", "-pix_fmt", "rgb24", "-s", "600x800", "-r", "30",
46    ]) // note: should be possible to infer these params from the source input stream
47    .input("-")
48    .args(["-c:v", "libx265"])
49    .args(["-y", "output/h265_overlay.mp4"])
50    .spawn()
51    .unwrap();
52
53  // Connect the two instances
54  let mut stdin = output.take_stdin().unwrap();
55  thread::spawn(move || {
56    // `for_each` blocks through the end of the iterator,
57    // so we run it in another thread.
58    transformed_frames.for_each(|f| {
59      stdin.write_all(&f.data).ok();
60    });
61  });
62
63  // On the main thread, run the output instance to completion
64  output.iter().unwrap().for_each(|e| match e {
65    FfmpegEvent::Log(LogLevel::Error, e) => println!("Error: {e}"),
66    FfmpegEvent::Progress(p) => println!("Progress: {} / 00:00:15", p.time),
67    _ => {}
68  });
69}
Source

pub fn filter_chunks(self) -> impl Iterator<Item = Vec<u8>>

Filter out all events except for output chunks (FfmpegEvent::OutputChunk).

Source

pub fn into_ffmpeg_stderr(self) -> impl Iterator<Item = String>

Iterator over every message from ffmpeg’s stderr as a raw string. Conceptually equivalent to BufReader::new(ffmpeg_stderr).lines().

Examples found in repository?
examples/whisper.rs (line 120)
110fn find_default_audio_device() -> anyhow::Result<String> {
111  if cfg!(windows) {
112    // Windows: Use dshow to find audio devices
113    let audio_device = FfmpegCommand::new()
114      .hide_banner()
115      .args(["-list_devices", "true"])
116      .format("dshow")
117      .input("dummy")
118      .spawn()?
119      .iter()?
120      .into_ffmpeg_stderr()
121      .find(|line| line.contains("(audio)"))
122      .and_then(|line| line.split('\"').nth(1).map(|s| s.to_string()))
123      .ok_or_else(|| anyhow::anyhow!("No audio device found on Windows"))?;
124
125    Ok(audio_device)
126  } else {
127    // Linux/Mac: Use default device (could be improved with proper device detection)
128    println!("Note: Using default audio device. On Linux/Mac, you may need to adjust audio format and device.");
129    Ok("default".to_string())
130  }
131}
More examples
Hide additional examples
examples/mic_meter.rs (line 29)
10pub fn main() -> Result<()> {
11  if cfg!(not(windows)) {
12    eprintln!("Note: Methods for capturing audio are platform-specific and this demo is intended for Windows.");
13    eprintln!("On Linux or Mac, you need to switch from the `dshow` format to a different one supported on your platform.");
14    eprintln!("Make sure to also include format-specific arguments such as `-audio_buffer_size`.");
15    eprintln!("Pull requests are welcome to make this demo cross-platform!");
16  }
17
18  // First step: find default audio input device
19  // Runs an `ffmpeg -list_devices` command and selects the first one found
20  // Sample log output: [dshow @ 000001c9babdb000] "Headset Microphone (Arctis 7 Chat)" (audio)
21
22  let audio_device = FfmpegCommand::new()
23    .hide_banner()
24    .args(["-list_devices", "true"])
25    .format("dshow")
26    .input("dummy")
27    .spawn()?
28    .iter()?
29    .into_ffmpeg_stderr()
30    .find(|line| line.contains("(audio)"))
31    .map(|line| line.split('\"').nth(1).map(|s| s.to_string()))
32    .context("No audio device found")?
33    .context("Failed to parse audio device")?;
34
35  println!("Listening to audio device: {audio_device}");
36
37  // Second step: Capture audio and analyze w/ `ebur128` audio filter
38  // Loudness metadata will be printed to the FFmpeg logs
39  // Docs: <https://ffmpeg.org/ffmpeg-filters.html#ebur128-1>
40
41  let iter = FfmpegCommand::new()
42    .format("dshow")
43    .args("-audio_buffer_size 50".split(' ')) // reduces latency to 50ms (dshow-specific)
44    .input(format!("audio={audio_device}"))
45    .args("-af ebur128=metadata=1,ametadata=print".split(' '))
46    .format("null")
47    .output("-")
48    .spawn()?
49    .iter()?;
50
51  // Note: even though the audio device name may have spaces, it should *not* be
52  // in quotes (""). Quotes are only needed on the command line to separate
53  // different arguments. Since Rust invokes the command directly without a
54  // shell interpreter, args are already divided up correctly. Any quotes
55  // would be included in the device name instead and the command would fail.
56  // <https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/648#issuecomment-866242144>
57
58  let mut first_volume_event = true;
59  for event in iter {
60    match event {
61      FfmpegEvent::Error(e) | FfmpegEvent::Log(LogLevel::Error | LogLevel::Fatal, e) => {
62        eprintln!("{e}");
63      }
64      FfmpegEvent::Log(LogLevel::Info, msg) if msg.contains("lavfi.r128.M=") => {
65        if let Some(volume) = msg.split("lavfi.r128.M=").last() {
66          // Sample log output: [Parsed_ametadata_1 @ 0000024c27effdc0] [info] lavfi.r128.M=-120.691
67          // M = "momentary loudness"; a sliding time window of 400ms
68          // Volume scale is roughly -70 to 0 LUFS. Anything below -70 is silence.
69          // See <https://en.wikipedia.org/wiki/EBU_R_128#Metering>
70          let volume_f32 = volume.parse::<f32>().context("Failed to parse volume")?;
71          let volume_normalized: usize = max(((volume_f32 / 5.0).round() as i32) + 14, 0) as usize;
72          let volume_percent = ((volume_normalized as f32 / 14.0) * 100.0).round();
73
74          // Clear previous line of output
75          if !first_volume_event {
76            print!("\x1b[1A\x1b[2K");
77          } else {
78            first_volume_event = false;
79          }
80
81          // Blinking red dot to indicate recording
82          let time = std::time::SystemTime::now()
83            .duration_since(std::time::UNIX_EPOCH)
84            .unwrap()
85            .as_secs();
86          let recording_indicator = if time % 2 == 0 { "🔴" } else { "  " };
87
88          println!(
89            "{} {} {}%",
90            recording_indicator,
91            "█".repeat(volume_normalized),
92            volume_percent
93          );
94        }
95      }
96      _ => {}
97    }
98  }
99
100  Ok(())
101}

Trait Implementations§

Source§

impl Iterator for FfmpegIterator

Source§

type Item = FfmpegEvent

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<Self::Item>

Advances the iterator and returns the next value. Read more
Source§

fn next_chunk<const N: usize>( &mut self, ) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
1.0.0 · Source§

fn count(self) -> usize
where Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
1.0.0 · Source§

fn last(self) -> Option<Self::Item>
where Self: Sized,

Consumes the iterator, returning the last element. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.0.0 · Source§

fn nth(&mut self, n: usize) -> Option<Self::Item>

Returns the nth element of the iterator. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Creates an iterator starting at the same point, but stepping by the given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where Self: Sized, U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where Self: Sized, U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where Self: Sized, Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent items of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where Self: Sized, G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator between adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each element. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element should be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates an iterator which gives the current iteration count as well as the next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where Self: Sized,

Creates an iterator which can use the peek and peek_mut methods to look at the next element of the iterator without consuming it. See their documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where Self: Sized, P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Creates an iterator that yields the first n elements, or fewer if the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but unlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where Self: Sized, U: IntoIterator, F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where Self: Sized, F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over self and returns an iterator over the outputs of f. Like slice::windows(), the windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where B: FromIterator<Self::Item>, Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where E: Extend<Self::Item>, Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where Self: Sized, B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where Self: Sized, P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Output = B>,

An iterator method that applies a function as long as it returns successfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where Self: Sized, F: FnMut(Self::Item) -> R, R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized, F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation, returning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing operation. Read more
Source§

fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where Self: Sized, R: Try<Output = Self::Item>, <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where Self: Sized, P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where Self: Sized, F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns the first non-none result. Read more
Source§

fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where Self: Sized, R: Try<Output = bool>, <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns the first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where Self: Sized, P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where B: Ord, Self: Sized, F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the specified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the specified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where B: Ord, Self: Sized, F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the specified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the specified comparison function. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where FromA: Default + Extend<A>, FromB: Default + Extend<B>, Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where T: Copy + 'a, Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where T: Clone + 'a, Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where Self: Sized, S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where Self: Sized, P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Lexicographically compares the PartialOrd elements of this Iterator with those of another. The comparison works like short-circuit evaluation, returning a result without comparing the remaining elements. As soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are equal to those of another. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where Self: Sized, I: IntoIterator, F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of another with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialEq<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are not equal to those of another. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where I: IntoIterator, Self::Item: PartialOrd<<I as IntoIterator>::Item>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where Self: Sized, F: FnMut(Self::Item) -> K, K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction function. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<I> IntoIterator for I
where I: Iterator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> I

Creates an iterator from a value. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.