fn capture_index(&mut self, capture: CaptureKind) -> Result<Opr24, ErrorKind> {
      // Iterating over captures maybe isn't most efficient here but it's not like we have
      // thousands of them anyways. Unless somebody absolutely crazy starts writing Mica code.
      // Then all I can say is: I hate you.
      let index = self.captures.iter().rposition(|c| c.eq(&capture)).unwrap_or_else(|| {
         let index = self.captures.len();
         self.captures.push(capture);
         index
      });
      Opr24::try_from(index).map_err(|_| ErrorKind::TooManyCaptures)
   }
/// Returns the index of the given capture.
Returns the index of the given capture.
Returns the index of the given capture .
fn capture_index(&mut self, capture: CaptureKind) -> Result<Opr24, ErrorKind> {
      // Iterating over captures maybe isn't most efficient here but it's not like we have
      // thousands of them anyways. Unless somebody absolutely crazy starts writing Mica code.
      // Then all I can say is: I hate you.
      let index = self.captures.iter().rposition(|c| c.eq(&capture)).unwrap_or_else(|| {
         let index = self.captures.len();
         self.captures.push(capture);
         index
      });
      Opr24::try_from(index).map_err(|_| ErrorKind::TooManyCaptures)
   }
fn capture_index ( & mut self , capture : CaptureKind ) -> Result < Opr24 , ErrorKind > { // Iterating over captures maybe isn't most efficient here but it's not like we have // thousands of them anyways. Unless somebody absolutely crazy starts writing Mica code. // Then all I can say is: I hate you. let index = self . captures . iter ( ) . rposition ( | c | c . eq ( & capture ) ) . unwrap_or_else ( | | { let index = self . captures . len ( ) ; self . captures . push ( capture ) ; index } ) ; Opr24 :: try_from ( index ) . map_err ( | _ | ErrorKind :: TooManyCaptures ) }
Returns the index of the given capture.
Returns the index of the given capture .
&mut self
capture
CaptureKind