File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -343,9 +343,8 @@ impl IggyClient {
343343 builder = builder. auto_commit ( auto_commit. into ( ) ) ;
344344 }
345345 builder = match poll_interval_micros {
346- Some ( micros) => {
347- builder. poll_interval ( non_zero_duration_micros ( "poll_interval_micros" , micros) ?)
348- }
346+ Some ( micros) => builder
347+ . poll_interval ( non_zero_duration_micros ( "poll_interval_micros" , micros) ?. get ( ) ) ,
349348 None => builder. without_poll_interval ( ) ,
350349 } ;
351350 if let Some ( micros) = polling_retry_interval_micros {
@@ -408,12 +407,7 @@ impl IggyClient {
408407 }
409408}
410409
411- fn non_zero_duration_micros ( field : & str , micros : u64 ) -> PhpResult < IggyDuration > {
412- if micros == 0 {
413- return Err ( to_php_exception ( format ! (
414- "'{field}' must be greater than 0 microseconds"
415- ) ) ) ;
416- }
417-
418- Ok ( IggyDuration :: from ( micros) )
410+ fn non_zero_duration_micros ( field : & str , micros : u64 ) -> PhpResult < NonZeroIggyDuration > {
411+ NonZeroIggyDuration :: try_from ( micros)
412+ . map_err ( |_| to_php_exception ( format ! ( "'{field}' must be greater than 0 microseconds" ) ) )
419413}
You can’t perform that action at this time.
0 commit comments