11use crate :: { get_default_provider, utils:: RawCStr } ;
22use eyre:: { bail, Result } ;
3- use std:: path:: Path ;
3+ use std:: { path:: Path , ptr :: null_mut } ;
44
55#[ derive( Debug ) ]
66pub struct Diarize {
@@ -14,7 +14,7 @@ pub struct Segment {
1414 pub speaker : i32 ,
1515}
1616
17- type ProgressCallback = Box < dyn Fn ( i32 , i32 ) -> i32 + Send + ' static > ;
17+ type ProgressCallback = Box < dyn ( Fn ( i32 , i32 ) -> i32 ) + Send + ' static > ;
1818
1919#[ derive( Debug , Clone ) ]
2020pub struct DiarizeConfig {
@@ -85,7 +85,7 @@ impl Diarize {
8585 let sd = unsafe { sherpa_rs_sys:: SherpaOnnxCreateOfflineSpeakerDiarization ( & config) } ;
8686
8787 if sd. is_null ( ) {
88- bail ! ( "Failed to initialize offline speaker diarization" )
88+ bail ! ( "Failed to initialize offline speaker diarization" ) ;
8989 }
9090 Ok ( Self { sd } )
9191 }
@@ -103,7 +103,7 @@ impl Diarize {
103103 let callback_ptr = callback_box
104104 . as_mut ( )
105105 . map ( |b| b. as_mut ( ) as * mut ProgressCallback as * mut std:: ffi:: c_void )
106- . unwrap_or ( std :: ptr :: null_mut ( ) ) ;
106+ . unwrap_or ( null_mut ( ) ) ;
107107
108108 let result = sherpa_rs_sys:: SherpaOnnxOfflineSpeakerDiarizationProcessWithCallback (
109109 self . sd ,
@@ -123,8 +123,9 @@ impl Diarize {
123123 sherpa_rs_sys:: SherpaOnnxOfflineSpeakerDiarizationResultSortByStartTime ( result) ;
124124
125125 if !segments_ptr. is_null ( ) && num_segments > 0 {
126- let segments_result: & [ sherpa_rs_sys:: SherpaOnnxOfflineSpeakerDiarizationSegment ] =
127- std:: slice:: from_raw_parts ( segments_ptr, num_segments as usize ) ;
126+ let segments_result: & [
127+ sherpa_rs_sys:: SherpaOnnxOfflineSpeakerDiarizationSegment
128+ ] = std:: slice:: from_raw_parts ( segments_ptr, num_segments as usize ) ;
128129
129130 for segment in segments_result {
130131 // Use segment here
0 commit comments