/// Return the `n`-th element of the given list. The first element (head of
/// the list) is at position 0. Return `None` if the list is too short.
Return the `n`-th element of the given list. The first element (head of
the list) is at position 0. Return `None` if the list is too short.
Return the ` n ` - th element of the given list . The first element ( head of the list ) is at position 0 . Return ` None ` if the list is too short .
pub fn nth(self, n: usize) -> Option<&'a T> {
        let mut node = self;
        let mut idx = 0;
        while let Cons((x, next)) = node {
            if n == idx {
                return Some(x);
            }
            node = *next;
            idx += 1;
        }
        None
    }
pub fn nth ( self , n : usize ) -> Option < & ' a T > { let mut node = self ; let mut idx = 0 ; while let Cons ( ( x , next ) ) = node { if n == idx { return Some ( x ) ; } node = * next ; idx += 1 ; } None }
Return the `n`-th element of the given list.
Return the ` n ` - th element of the given list .
self
n
usize