MCPcopy Index your code
hub / github.com/RustPython/RustPython / build

Method build

crates/stdlib/src/ssl/oid.rs:89–110  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

87
88impl OidTable {
89 fn build() -> Self {
90 let entries = build_oid_entries();
91 let mut nid_to_idx = HashMap::with_capacity(entries.len());
92 let mut short_name_to_idx = HashMap::with_capacity(entries.len());
93 let mut long_name_to_idx = HashMap::with_capacity(entries.len());
94 let mut oid_str_to_idx = HashMap::with_capacity(entries.len());
95
96 for (idx, entry) in entries.iter().enumerate() {
97 nid_to_idx.insert(entry.nid, idx);
98 short_name_to_idx.insert(entry.short_name, idx);
99 long_name_to_idx.insert(entry.long_name.to_lowercase(), idx);
100 oid_str_to_idx.insert(entry.oid_string(), idx);
101 }
102
103 Self {
104 entries,
105 nid_to_idx,
106 short_name_to_idx,
107 long_name_to_idx,
108 oid_str_to_idx,
109 }
110 }
111
112 pub fn find_by_nid(&self, nid: i32) -> Option<&OidEntry> {
113 self.nid_to_idx.get(&nid).map(|&idx| &self.entries[idx])

Callers 6

load_client_ca_listFunction · 0.45
make_regexFunction · 0.45
to_readerMethod · 0.45
to_writerMethod · 0.45
create_server_configFunction · 0.45

Calls 6

build_oid_entriesFunction · 0.85
to_lowercaseMethod · 0.80
oid_stringMethod · 0.80
lenMethod · 0.45
iterMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected