@@ -266,7 +266,7 @@ pub trait BinaryViewExt: BinaryViewBase {
266266 unsafe { BNGetEndOffset ( self . as_ref ( ) . handle ) }
267267 }
268268
269- fn add_analysis_option ( & self , name : impl AsCStr ) {
269+ fn add_analysis_option ( & self , name : impl IntoCStr ) {
270270 let name = name. to_cstr ( ) ;
271271 unsafe { BNAddAnalysisOption ( self . as_ref ( ) . handle , name. as_ptr ( ) ) }
272272 }
@@ -399,7 +399,7 @@ pub trait BinaryViewExt: BinaryViewBase {
399399 }
400400 }
401401
402- fn symbol_by_raw_name < S : AsCStr > ( & self , raw_name : S ) -> Option < Ref < Symbol > > {
402+ fn symbol_by_raw_name < S : IntoCStr > ( & self , raw_name : S ) -> Option < Ref < Symbol > > {
403403 let raw_name = raw_name. to_cstr ( ) ;
404404
405405 unsafe {
@@ -424,7 +424,7 @@ pub trait BinaryViewExt: BinaryViewBase {
424424 }
425425 }
426426
427- fn symbols_by_name < S : AsCStr > ( & self , name : S ) -> Array < Symbol > {
427+ fn symbols_by_name < S : IntoCStr > ( & self , name : S ) -> Array < Symbol > {
428428 let raw_name = name. to_cstr ( ) ;
429429
430430 unsafe {
@@ -585,7 +585,7 @@ pub trait BinaryViewExt: BinaryViewBase {
585585 }
586586 }
587587
588- fn define_auto_type < T : Into < QualifiedName > , S : AsCStr > (
588+ fn define_auto_type < T : Into < QualifiedName > , S : IntoCStr > (
589589 & self ,
590590 name : T ,
591591 source : S ,
@@ -602,7 +602,7 @@ pub trait BinaryViewExt: BinaryViewBase {
602602 QualifiedName :: from_owned_raw ( name_handle)
603603 }
604604
605- fn define_auto_type_with_id < T : Into < QualifiedName > , S : AsCStr > (
605+ fn define_auto_type_with_id < T : Into < QualifiedName > , S : IntoCStr > (
606606 & self ,
607607 name : T ,
608608 id : S ,
@@ -712,7 +712,7 @@ pub trait BinaryViewExt: BinaryViewBase {
712712 }
713713 }
714714
715- fn undefine_auto_type < S : AsCStr > ( & self , id : S ) {
715+ fn undefine_auto_type < S : IntoCStr > ( & self , id : S ) {
716716 let id_str = id. to_cstr ( ) ;
717717 unsafe {
718718 BNUndefineAnalysisType ( self . as_ref ( ) . handle , id_str. as_ref ( ) . as_ptr ( ) as * const _ ) ;
@@ -763,7 +763,7 @@ pub trait BinaryViewExt: BinaryViewBase {
763763 }
764764 }
765765
766- fn type_by_id < S : AsCStr > ( & self , id : S ) -> Option < Ref < Type > > {
766+ fn type_by_id < S : IntoCStr > ( & self , id : S ) -> Option < Ref < Type > > {
767767 let id_str = id. to_cstr ( ) ;
768768 unsafe {
769769 let type_handle = BNGetAnalysisTypeById ( self . as_ref ( ) . handle , id_str. as_ptr ( ) ) ;
@@ -774,7 +774,7 @@ pub trait BinaryViewExt: BinaryViewBase {
774774 }
775775 }
776776
777- fn type_name_by_id < S : AsCStr > ( & self , id : S ) -> Option < QualifiedName > {
777+ fn type_name_by_id < S : IntoCStr > ( & self , id : S ) -> Option < QualifiedName > {
778778 let id_str = id. to_cstr ( ) ;
779779 unsafe {
780780 let name_handle = BNGetAnalysisTypeNameById ( self . as_ref ( ) . handle , id_str. as_ptr ( ) ) ;
@@ -871,23 +871,23 @@ pub trait BinaryViewExt: BinaryViewBase {
871871 section. create ( self . as_ref ( ) ) ;
872872 }
873873
874- fn remove_auto_section < S : AsCStr > ( & self , name : S ) {
874+ fn remove_auto_section < S : IntoCStr > ( & self , name : S ) {
875875 let raw_name = name. to_cstr ( ) ;
876876 let raw_name_ptr = raw_name. as_ptr ( ) ;
877877 unsafe {
878878 BNRemoveAutoSection ( self . as_ref ( ) . handle , raw_name_ptr) ;
879879 }
880880 }
881881
882- fn remove_user_section < S : AsCStr > ( & self , name : S ) {
882+ fn remove_user_section < S : IntoCStr > ( & self , name : S ) {
883883 let raw_name = name. to_cstr ( ) ;
884884 let raw_name_ptr = raw_name. as_ptr ( ) ;
885885 unsafe {
886886 BNRemoveUserSection ( self . as_ref ( ) . handle , raw_name_ptr) ;
887887 }
888888 }
889889
890- fn section_by_name < S : AsCStr > ( & self , name : S ) -> Option < Ref < Section > > {
890+ fn section_by_name < S : IntoCStr > ( & self , name : S ) -> Option < Ref < Section > > {
891891 unsafe {
892892 let raw_name = name. to_cstr ( ) ;
893893 let name_ptr = raw_name. as_ptr ( ) ;
@@ -1103,14 +1103,14 @@ pub trait BinaryViewExt: BinaryViewBase {
11031103 unsafe { BNApplyDebugInfo ( self . as_ref ( ) . handle , debug_info. handle ) }
11041104 }
11051105
1106- fn show_graph_report < S : AsCStr > ( & self , raw_name : S , graph : & FlowGraph ) {
1106+ fn show_graph_report < S : IntoCStr > ( & self , raw_name : S , graph : & FlowGraph ) {
11071107 let raw_name = raw_name. to_cstr ( ) ;
11081108 unsafe {
11091109 BNShowGraphReport ( self . as_ref ( ) . handle , raw_name. as_ptr ( ) , graph. handle ) ;
11101110 }
11111111 }
11121112
1113- fn load_settings < S : AsCStr > ( & self , view_type_name : S ) -> Result < Ref < Settings > > {
1113+ fn load_settings < S : IntoCStr > ( & self , view_type_name : S ) -> Result < Ref < Settings > > {
11141114 let view_type_name = view_type_name. to_cstr ( ) ;
11151115 let settings_handle =
11161116 unsafe { BNBinaryViewGetLoadSettings ( self . as_ref ( ) . handle , view_type_name. as_ptr ( ) ) } ;
@@ -1122,7 +1122,7 @@ pub trait BinaryViewExt: BinaryViewBase {
11221122 }
11231123 }
11241124
1125- fn set_load_settings < S : AsCStr > ( & self , view_type_name : S , settings : & Settings ) {
1125+ fn set_load_settings < S : IntoCStr > ( & self , view_type_name : S , settings : & Settings ) {
11261126 let view_type_name = view_type_name. to_cstr ( ) ;
11271127
11281128 unsafe {
@@ -1139,7 +1139,7 @@ pub trait BinaryViewExt: BinaryViewBase {
11391139 /// # Arguments
11401140 /// * `name` - the name for the tag
11411141 /// * `icon` - the icon (recommended 1 emoji or 2 chars) for the tag
1142- fn create_tag_type < N : AsCStr , I : AsCStr > ( & self , name : N , icon : I ) -> Ref < TagType > {
1142+ fn create_tag_type < N : IntoCStr , I : IntoCStr > ( & self , name : N , icon : I ) -> Ref < TagType > {
11431143 let tag_type = TagType :: create ( self . as_ref ( ) , name, icon) ;
11441144 unsafe {
11451145 BNAddTagType ( self . as_ref ( ) . handle , tag_type. handle ) ;
@@ -1153,7 +1153,7 @@ pub trait BinaryViewExt: BinaryViewBase {
11531153 }
11541154
11551155 /// Get a tag type by its name.
1156- fn tag_type_by_name < S : AsCStr > ( & self , name : S ) -> Option < Ref < TagType > > {
1156+ fn tag_type_by_name < S : IntoCStr > ( & self , name : S ) -> Option < Ref < TagType > > {
11571157 let name = name. to_cstr ( ) ;
11581158 unsafe {
11591159 let handle = BNGetTagType ( self . as_ref ( ) . handle , name. as_ptr ( ) ) ;
@@ -1167,7 +1167,7 @@ pub trait BinaryViewExt: BinaryViewBase {
11671167 /// Get a tag by its id.
11681168 ///
11691169 /// Note this does not tell you anything about where it is used.
1170- fn tag_by_id < S : AsCStr > ( & self , id : S ) -> Option < Ref < Tag > > {
1170+ fn tag_by_id < S : IntoCStr > ( & self , id : S ) -> Option < Ref < Tag > > {
11711171 let id = id. to_cstr ( ) ;
11721172 unsafe {
11731173 let handle = BNGetTag ( self . as_ref ( ) . handle , id. as_ptr ( ) ) ;
@@ -1181,7 +1181,7 @@ pub trait BinaryViewExt: BinaryViewBase {
11811181 /// Creates and adds a tag to an address
11821182 ///
11831183 /// User tag creations will be added to the undo buffer
1184- fn add_tag < S : AsCStr > ( & self , addr : u64 , t : & TagType , data : S , user : bool ) {
1184+ fn add_tag < S : IntoCStr > ( & self , addr : u64 , t : & TagType , data : S , user : bool ) {
11851185 let tag = Tag :: new ( t, data) ;
11861186
11871187 unsafe { BNAddTag ( self . as_ref ( ) . handle , tag. handle , user) }
@@ -1218,7 +1218,7 @@ pub trait BinaryViewExt: BinaryViewBase {
12181218 ///
12191219 /// NOTE: This is different from setting a comment at the function-level. To set a comment in a
12201220 /// function use [`Function::set_comment_at`]
1221- fn set_comment_at ( & self , addr : u64 , comment : impl AsCStr ) {
1221+ fn set_comment_at ( & self , addr : u64 , comment : impl IntoCStr ) {
12221222 let comment_raw = comment. to_cstr ( ) ;
12231223 unsafe { BNSetGlobalCommentForAddress ( self . as_ref ( ) . handle , addr, comment_raw. as_ptr ( ) ) }
12241224 }
@@ -1271,7 +1271,7 @@ pub trait BinaryViewExt: BinaryViewBase {
12711271 result
12721272 }
12731273
1274- fn query_metadata < S : AsCStr > ( & self , key : S ) -> Option < Ref < Metadata > > {
1274+ fn query_metadata < S : IntoCStr > ( & self , key : S ) -> Option < Ref < Metadata > > {
12751275 let key = key. to_cstr ( ) ;
12761276 let value: * mut BNMetadata =
12771277 unsafe { BNBinaryViewQueryMetadata ( self . as_ref ( ) . handle , key. as_ptr ( ) ) } ;
@@ -1282,15 +1282,15 @@ pub trait BinaryViewExt: BinaryViewBase {
12821282 }
12831283 }
12841284
1285- fn get_metadata < T , S : AsCStr > ( & self , key : S ) -> Option < Result < T > >
1285+ fn get_metadata < T , S : IntoCStr > ( & self , key : S ) -> Option < Result < T > >
12861286 where
12871287 T : for < ' a > TryFrom < & ' a Metadata > ,
12881288 {
12891289 self . query_metadata ( key)
12901290 . map ( |md| T :: try_from ( md. as_ref ( ) ) . map_err ( |_| ( ) ) )
12911291 }
12921292
1293- fn store_metadata < V , S : AsCStr > ( & self , key : S , value : V , is_auto : bool )
1293+ fn store_metadata < V , S : IntoCStr > ( & self , key : S , value : V , is_auto : bool )
12941294 where
12951295 V : Into < Ref < Metadata > > ,
12961296 {
@@ -1306,7 +1306,7 @@ pub trait BinaryViewExt: BinaryViewBase {
13061306 } ;
13071307 }
13081308
1309- fn remove_metadata < S : AsCStr > ( & self , key : S ) {
1309+ fn remove_metadata < S : IntoCStr > ( & self , key : S ) {
13101310 let key = key. to_cstr ( ) ;
13111311 unsafe { BNBinaryViewRemoveMetadata ( self . as_ref ( ) . handle , key. as_ptr ( ) ) } ;
13121312 }
@@ -1432,7 +1432,7 @@ pub trait BinaryViewExt: BinaryViewBase {
14321432 . collect ( )
14331433 }
14341434
1435- fn component_by_guid < S : AsCStr > ( & self , guid : S ) -> Option < Ref < Component > > {
1435+ fn component_by_guid < S : IntoCStr > ( & self , guid : S ) -> Option < Ref < Component > > {
14361436 let name = guid. to_cstr ( ) ;
14371437 let result = unsafe { BNGetComponentByGuid ( self . as_ref ( ) . handle , name. as_ptr ( ) ) } ;
14381438 NonNull :: new ( result) . map ( |h| unsafe { Component :: ref_from_raw ( h) } )
@@ -1443,7 +1443,7 @@ pub trait BinaryViewExt: BinaryViewBase {
14431443 NonNull :: new ( result) . map ( |h| unsafe { Component :: ref_from_raw ( h) } )
14441444 }
14451445
1446- fn component_by_path < P : AsCStr > ( & self , path : P ) -> Option < Ref < Component > > {
1446+ fn component_by_path < P : IntoCStr > ( & self , path : P ) -> Option < Ref < Component > > {
14471447 let path = path. to_cstr ( ) ;
14481448 let result = unsafe { BNGetComponentByPath ( self . as_ref ( ) . handle , path. as_ptr ( ) ) } ;
14491449 NonNull :: new ( result) . map ( |h| unsafe { Component :: ref_from_raw ( h) } )
@@ -1453,7 +1453,7 @@ pub trait BinaryViewExt: BinaryViewBase {
14531453 unsafe { BNRemoveComponent ( self . as_ref ( ) . handle , component. handle . as_ptr ( ) ) }
14541454 }
14551455
1456- fn remove_component_by_guid < P : AsCStr > ( & self , guid : P ) -> bool {
1456+ fn remove_component_by_guid < P : IntoCStr > ( & self , guid : P ) -> bool {
14571457 let path = guid. to_cstr ( ) ;
14581458 unsafe { BNRemoveComponentByGuid ( self . as_ref ( ) . handle , path. as_ptr ( ) ) }
14591459 }
@@ -1476,20 +1476,20 @@ pub trait BinaryViewExt: BinaryViewBase {
14761476 unsafe { Array :: new ( result, count, ( ) ) }
14771477 }
14781478
1479- fn external_library < S : AsCStr > ( & self , name : S ) -> Option < Ref < ExternalLibrary > > {
1479+ fn external_library < S : IntoCStr > ( & self , name : S ) -> Option < Ref < ExternalLibrary > > {
14801480 let name_ptr = name. to_cstr ( ) ;
14811481 let result =
14821482 unsafe { BNBinaryViewGetExternalLibrary ( self . as_ref ( ) . handle , name_ptr. as_ptr ( ) ) } ;
14831483 let result_ptr = NonNull :: new ( result) ?;
14841484 Some ( unsafe { ExternalLibrary :: ref_from_raw ( result_ptr) } )
14851485 }
14861486
1487- fn remove_external_library < S : AsCStr > ( & self , name : S ) {
1487+ fn remove_external_library < S : IntoCStr > ( & self , name : S ) {
14881488 let name_ptr = name. to_cstr ( ) ;
14891489 unsafe { BNBinaryViewRemoveExternalLibrary ( self . as_ref ( ) . handle , name_ptr. as_ptr ( ) ) } ;
14901490 }
14911491
1492- fn add_external_library < S : AsCStr > (
1492+ fn add_external_library < S : IntoCStr > (
14931493 & self ,
14941494 name : S ,
14951495 backing_file : Option < & ProjectFile > ,
@@ -1531,7 +1531,7 @@ pub trait BinaryViewExt: BinaryViewBase {
15311531 }
15321532
15331533 // TODO: This is awful, rewrite this.
1534- fn add_external_location < S : AsCStr > (
1534+ fn add_external_location < S : IntoCStr > (
15351535 & self ,
15361536 symbol : & Symbol ,
15371537 library : & ExternalLibrary ,
@@ -1589,7 +1589,7 @@ pub trait BinaryViewExt: BinaryViewBase {
15891589 unsafe { BNAddBinaryViewTypeLibrary ( self . as_ref ( ) . handle , library. as_raw ( ) ) }
15901590 }
15911591
1592- fn type_library_by_name < S : AsCStr > ( & self , name : S ) -> Option < TypeLibrary > {
1592+ fn type_library_by_name < S : IntoCStr > ( & self , name : S ) -> Option < TypeLibrary > {
15931593 let name = name. to_cstr ( ) ;
15941594 let result = unsafe { BNGetBinaryViewTypeLibrary ( self . as_ref ( ) . handle , name. as_ptr ( ) ) } ;
15951595 NonNull :: new ( result) . map ( |h| unsafe { TypeLibrary :: from_raw ( h) } )
@@ -1682,7 +1682,7 @@ pub trait BinaryViewExt: BinaryViewBase {
16821682 /// contain a metadata key called "type_guids" which is a map
16831683 /// Dict[string_guid, string_type_name] or
16841684 /// Dict[string_guid, Tuple[string_type_name, type_library_name]]
1685- fn import_type_by_guid < S : AsCStr > ( & self , guid : S ) -> Option < Ref < Type > > {
1685+ fn import_type_by_guid < S : IntoCStr > ( & self , guid : S ) -> Option < Ref < Type > > {
16861686 let guid = guid. to_cstr ( ) ;
16871687 let result =
16881688 unsafe { BNBinaryViewImportTypeLibraryTypeByGuid ( self . as_ref ( ) . handle , guid. as_ptr ( ) ) } ;
0 commit comments