pub fn name_table(&self) -> BTreeMap<String, Vec<usize>> {
        unsafe {
            let name_count = self.name_count();
            let mut tabptr: *const c_uchar = ptr::null();
            detail::pcre_fullinfo(self.code, self.extra as *const PcreExtra, libpcre_sys::PCRE_INFO_NAMETABLE, &mut tabptr as *mut *const c_uchar as *mut c_void);
            let mut name_entry_size: c_int = 0;
            detail::pcre_fullinfo(self.code, self.extra as *const PcreExtra, libpcre_sys::PCRE_INFO_NAMEENTRYSIZE, &mut name_entry_size as *mut c_int as *mut c_void);

            let mut name_table: BTreeMap<String, Vec<usize>> = BTreeMap::new();

            let mut i = 0;
            while i < name_count {
                let n: usize = ((ptr::read(tabptr) as usize) << 8) | (ptr::read(tabptr.offset(1)) as usize);
                let name_cstr = CStr::from_ptr(tabptr.offset(2) as *const c_char);
                // TODO Check memory allocations
                let name: String = String::from_utf8(Vec::from(name_cstr.to_bytes())).unwrap();
                // TODO Avoid the double lookup.
                // https://github.com/mozilla/rust/issues/9068
                if !name_table.contains_key(&name) {
                    name_table.insert(name, vec![n]);
                } else {
                    name_table.get_mut(&name).unwrap().push(n);
                }
                tabptr = tabptr.offset(name_entry_size as isize);
                i += 1;
            }

            name_table
        }
    }
/// Creates a name-to-number translation table that maps the name of each named capture
/// group to the assigned group numbers.
///
/// The value type of the returned `BTreeMap` is a `usize` vector because there can be
/// more than one group number for a given name if the PCRE_DUPNAMES option is used
/// when compiling the regular expression.
Creates a name-to-number translation table that maps the name of each named capture
group to the assigned group numbers.

The value type of the returned `BTreeMap` is a `usize` vector because there can be
more than one group number for a given name if the PCRE_DUPNAMES option is used
when compiling the regular expression.
Creates a name - to - number translation table that maps the name of each named capture group to the assigned group numbers . The value type of the returned ` BTreeMap ` is a ` usize ` vector because there can be more than one group number for a given name if the PCRE_DUPNAMES option is used when compiling the regular expression .
pub fn name_table(&self) -> BTreeMap<String, Vec<usize>> {
        unsafe {
            let name_count = self.name_count();
            let mut tabptr: *const c_uchar = ptr::null();
            detail::pcre_fullinfo(self.code, self.extra as *const PcreExtra, libpcre_sys::PCRE_INFO_NAMETABLE, &mut tabptr as *mut *const c_uchar as *mut c_void);
            let mut name_entry_size: c_int = 0;
            detail::pcre_fullinfo(self.code, self.extra as *const PcreExtra, libpcre_sys::PCRE_INFO_NAMEENTRYSIZE, &mut name_entry_size as *mut c_int as *mut c_void);
            let mut name_table: BTreeMap<String, Vec<usize>> = BTreeMap::new();
            let mut i = 0;
            while i < name_count {
                let n: usize = ((ptr::read(tabptr) as usize) << 8) | (ptr::read(tabptr.offset(1)) as usize);
                let name_cstr = CStr::from_ptr(tabptr.offset(2) as *const c_char);
                // TODO Check memory allocations
                let name: String = String::from_utf8(Vec::from(name_cstr.to_bytes())).unwrap();
                // TODO Avoid the double lookup.
                // https://github.com/mozilla/rust/issues/9068
                if !name_table.contains_key(&name) {
                    name_table.insert(name, vec![n]);
                } else {
                    name_table.get_mut(&name).unwrap().push(n);
                }
                tabptr = tabptr.offset(name_entry_size as isize);
                i += 1;
            }
            name_table
        }
    }
pub fn name_table ( & self ) -> BTreeMap < String , Vec < usize > > { unsafe { let name_count = self . name_count ( ) ; let mut tabptr : * const c_uchar = ptr :: null ( ) ; detail :: pcre_fullinfo ( self . code , self . extra as * const PcreExtra , libpcre_sys :: PCRE_INFO_NAMETABLE , & mut tabptr as * mut * const c_uchar as * mut c_void ) ; let mut name_entry_size : c_int = 0 ; detail :: pcre_fullinfo ( self . code , self . extra as * const PcreExtra , libpcre_sys :: PCRE_INFO_NAMEENTRYSIZE , & mut name_entry_size as * mut c_int as * mut c_void ) ; let mut name_table : BTreeMap < String , Vec < usize > > = BTreeMap :: new ( ) ; let mut i = 0 ; while i < name_count { let n : usize = ( ( ptr :: read ( tabptr ) as usize ) << 8 ) | ( ptr :: read ( tabptr . offset ( 1 ) ) as usize ) ; let name_cstr = CStr :: from_ptr ( tabptr . offset ( 2 ) as * const c_char ) ; // TODO Check memory allocations let name : String = String :: from_utf8 ( Vec :: from ( name_cstr . to_bytes ( ) ) ) . unwrap ( ) ; // TODO Avoid the double lookup. // https://github.com/mozilla/rust/issues/9068 if ! name_table . contains_key ( & name ) { name_table . insert ( name , vec ! [ n ] ) ; } else { name_table . get_mut ( & name ) . unwrap ( ) . push ( n ) ; } tabptr = tabptr . offset ( name_entry_size as isize ) ; i += 1 ; } name_table } }
Creates a name-to-number translation table that maps the name of each named capture
group to the assigned group numbers.
Creates a name - to - number translation table that maps the name of each named capture group to the assigned group numbers .
&self
&self