File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,10 @@ impl Platform {
173173 unsafe { TypeContainer :: from_raw ( type_container_ptr. unwrap ( ) ) }
174174 }
175175
176+ /// Get all the type libraries that have been registered with the name.
177+ ///
178+ /// NOTE: This is a list because libraries can have `alternate_names`, use [`Platform::get_type_library_by_name`]
179+ /// if you want to get _the_ type library with that name, skipping alternate names.
176180 pub fn get_type_libraries_by_name ( & self , name : & str ) -> Array < TypeLibrary > {
177181 let mut count = 0 ;
178182 let name = name. to_cstr ( ) ;
@@ -182,6 +186,17 @@ impl Platform {
182186 unsafe { Array :: new ( result, count, ( ) ) }
183187 }
184188
189+ /// Get the type library with the given name.
190+ ///
191+ /// NOTE: This finds the first type library that has the given name, skipping alternate names.
192+ pub fn get_type_library_by_name ( & self , name : & str ) -> Option < Ref < TypeLibrary > > {
193+ let libraries = self . get_type_libraries_by_name ( name) ;
194+ libraries
195+ . iter ( )
196+ . find ( |lib| lib. name ( ) == name)
197+ . map ( |lib| lib. to_owned ( ) )
198+ }
199+
185200 pub fn register_os ( & self , os : & str ) {
186201 let os = os. to_cstr ( ) ;
187202 unsafe {
You can’t perform that action at this time.
0 commit comments