Skip to content

Instantly share code, notes, and snippets.

@antifuchs
Created April 23, 2016 22:48
Show Gist options
  • Save antifuchs/7920de785b248040a969b3bc730bb9ef to your computer and use it in GitHub Desktop.
Save antifuchs/7920de785b248040a969b3bc730bb9ef to your computer and use it in GitHub Desktop.
// An iterator over the File descriptors contained in an FD ring buffer
pub struct RingIter<'a> {
ring: &'a Ring,
offset: u64,
}
impl Iterator for RingIter<'a> {
type Item = RawFd;
fn next(&'a mut self) -> Option<RawFd> {
// ...
}
}
//////
// Result:
// src/ring.rs:152:28: 152:30 error: use of undeclared lifetime name `'a` [E0261]
// src/ring.rs:152 impl Iterator for RingIter<'a> {
// ^~
// src/ring.rs:152:28: 152:30 help: run `rustc --explain E0261` to see a detailed explanation
// src/ring.rs:155:14: 155:16 error: use of undeclared lifetime name `'a` [E0261]
// src/ring.rs:155 fn next(&'a mut self) -> Option<RawFd> {
// ^~
//
// An iterator over the File descriptors contained in an FD ring buffer
pub struct RingIter<'a> {
ring: &'a Ring,
offset: u64,
}
impl Iterator for RingIter {
type Item = RawFd;
fn next(&mut self) -> Option<RawFd> {
// ...
}
}
/////
// Result:
// src/ring.rs:152:19: 152:27 error: wrong number of lifetime parameters: expected 1, found 0 [E0107]
// src/ring.rs:152 impl Iterator for RingIter {
// ^~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment