merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
Showing only changes of commit e9dbcb272e - Show all commits

View File

@ -23,19 +23,13 @@ pub fn start_hamming_algorithm(input: &TextView, output: &TextView, mode: bool)
Ok(res) => output.buffer().set_text(res.trim_end()), Ok(res) => output.buffer().set_text(res.trim_end()),
Err(rej) => output.buffer().set_text(rej.as_str()), Err(rej) => output.buffer().set_text(rej.as_str()),
} }
hamming(parsed_input, operation)
} }
pub fn check_correct_binary_code( pub fn check_correct_binary_code(input: &str, prepared_input: &str, l: usize) -> (bool, bool) {
input: &String, let first_condition: bool = prepared_input.len() % l == 0;
prepared_input: &String,
l: usize,
) -> (bool, bool) {
let first_condition: bool = input
.as_str()
.chars()
.all(|c| c == '1' || c == '0' || c == ' ');
let second_condition: bool = prepared_input.len() % l == 0; let second_condition: bool = input.chars().all(|c| c == '1' || c == '0' || c == ' ');
(first_condition, second_condition) (first_condition, second_condition)
} }