Skip to content

Commit 62a66dd

Browse files
committed
[rust] Organize private functions for selenium-manager in lib.rs
1 parent d4332eb commit 62a66dd

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

rust/src/lib.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -515,31 +515,12 @@ pub fn create_default_http_client() -> Client {
515515
.unwrap_or_default()
516516
}
517517

518-
// ----------------------------------------------------------
519-
// Private functions
520-
// ----------------------------------------------------------
521-
522-
fn get_index_version(full_version: &str, index: usize) -> Result<String, Box<dyn Error>> {
523-
let version_vec: Vec<&str> = full_version.split('.').collect();
524-
Ok(version_vec
525-
.get(index)
526-
.ok_or(format!("Wrong version: {}", full_version))?
527-
.to_string())
528-
}
529-
530518
pub fn http_client_builder() -> ClientBuilder {
531519
Client::builder()
532520
.danger_accept_invalid_certs(true)
533521
.use_rustls_tls()
534522
}
535523

536-
fn strip_trailing_newline(input: &str) -> &str {
537-
input
538-
.strip_suffix(CRLF)
539-
.or_else(|| input.strip_suffix(LF))
540-
.unwrap_or(input)
541-
}
542-
543524
pub fn run_shell_command(os: &str, command: String) -> Result<String, Box<dyn Error>> {
544525
let (shell, flag) = if WINDOWS.is(os) {
545526
("cmd", "/C")
@@ -563,6 +544,25 @@ pub fn format_two_args(string: &str, arg1: &str, arg2: &str) -> String {
563544
string.replacen("{}", arg1, 1).replacen("{}", arg2, 2)
564545
}
565546

547+
// ----------------------------------------------------------
548+
// Private functions
549+
// ----------------------------------------------------------
550+
551+
fn get_index_version(full_version: &str, index: usize) -> Result<String, Box<dyn Error>> {
552+
let version_vec: Vec<&str> = full_version.split('.').collect();
553+
Ok(version_vec
554+
.get(index)
555+
.ok_or(format!("Wrong version: {}", full_version))?
556+
.to_string())
557+
}
558+
559+
fn strip_trailing_newline(input: &str) -> &str {
560+
input
561+
.strip_suffix(CRLF)
562+
.or_else(|| input.strip_suffix(LF))
563+
.unwrap_or(input)
564+
}
565+
566566
fn split_lines(string: &str) -> Vec<&str> {
567567
if string.contains(CRLF) {
568568
string.split(CRLF).collect()

0 commit comments

Comments
 (0)