// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
  let regex = Regex::new(r"(?m)\s(?:(?:\w+::)*(\w+)(?:<[\w, ]+>){0,1}::){0,1}(\w+)[(]").unwrap();
  let string = "void rmdt::Worker<T_Channel, T_TransportControl>::setOption(rmdt::SockOpt, int64_t) [with T_Channel = iptransport::udp::Socket; T_TransportControl = rmdt::AggressiveTransportControl; int64_t = long int]
std::error_code rmdt::ReceiveHandler<T_Channel>::internalRunSenderPart(int32_t) [with T_Channel = iptransport::udp::Socket; int32_t = int]
void dex::rmdt::Worker::setOption(rmdt::SockOpt, int64_t)
void Worker::setOption(rmdt::SockOpt, int64_t)
std::pair <HandshakeRequestPayload,int64_t> rmdt::HandshakeAcceptor<T_Channel, T_Val>::receiveHandshake(int)
std::vector<std::__cxx11::basic_string<char> > rmdt::Worker<T_Channel, T_TransportControl>::connect() [with T_Channel = iptransport::udp::Socket; T_TransportControl = rmdt::BQLLP] 
dex::type dex::func(int d)
void func(int d)";
  
  // result will be an iterator over tuples containing the start and end indices for each match in the string
  let result = regex.captures_iter(string);
  
  for mat in result {
    println!("{:?}", mat);
  }
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/