removed unnecessary module definitions

This commit is contained in:
2024-03-10 12:54:32 +04:00
parent 54619cd3f9
commit 4c230c090d
11 changed files with 702 additions and 743 deletions

View File

@@ -1,72 +1,68 @@
pub mod input_utils_module {
use gtk4 as gtk;
use gtk4 as gtk;
use std::ops::Deref;
use gtk::{*, prelude::*};
use bitvec::{order::Lsb0, view::AsBits};
use std::ops::Deref;
use gtk::{*, prelude::*};
use bitvec::{order::Lsb0, view::AsBits};
use crate::{
model::model::*,
model_utils::hamming_code_seven_four::*
};
use crate::{
model::model::model_module::*,
model_utils::hamming_code_seven_four::hamming_code::*
pub fn parse_input(input : &TextView, output : &TextView, mode: bool) -> (){
let (iter_start, iter_end) = input.buffer().bounds();
let parsed_input : String = input
.buffer()
.text(&iter_start, &iter_end, false)
.to_string()
.trim()
.parse()
.unwrap();
let operation = if mode == false {
HammingMode::Encrypt
} else {
HammingMode::Decrypt
};
pub fn parse_input(input : &TextView, output : &TextView, mode: bool) -> (){
let (iter_start, iter_end) = input.buffer().bounds();
let parsed_input : String = input
.buffer()
.text(&iter_start, &iter_end, false)
.to_string()
.trim()
.parse()
.unwrap();
let operation = if mode == false {
HammingMode::Encrypt
} else {
HammingMode::Decrypt
};
match hamming(parsed_input, operation) {
Ok(res) => output.buffer().set_text(res.trim_end()),
Err(rej) => output.buffer().set_text(rej.as_str()),
}
match hamming(parsed_input, operation) {
Ok(res) => output.buffer().set_text(res.trim_end()),
Err(rej) => output.buffer().set_text(rej.as_str()),
}
pub fn processing_input(input : &String) -> String {
}
input
.split_ascii_whitespace()
.filter(|&x| {
x != ""
})
.fold(String::new(), |c: String, n: &str| { c + n })
pub fn processing_input(input : &String) -> String {
}
input
.split_ascii_whitespace()
.filter(|&x| {
x != ""
})
.fold(String::new(), |c: String, n: &str| { c + n })
pub fn check_correct_input(input: &String, prepared_input: &String, l: usize) -> (bool, bool){
}
let first_condition = input
.chars()
.all(|c| {c == '1' || c == '0' || c == ' '});
pub fn check_correct_input(input: &String, prepared_input: &String, l: usize) -> (bool, bool){
let second_condition = prepared_input.len() % l == 0;
let first_condition = input
.chars()
.all(|c| {c == '1' || c == '0' || c == ' '});
(first_condition, second_condition)
let second_condition = prepared_input.len() % l == 0;
}
(first_condition, second_condition)
pub fn from_string_to_vec_bits(raw_data: String) -> Vec<u8>{
}
raw_data
.as_bits::<Lsb0>()
.iter()
.step_by(8)
.map(|x| *x.deref() as u8)
.collect()
pub fn from_string_to_vec_bits(raw_data: String) -> Vec<u8>{
}
raw_data
.as_bits::<Lsb0>()
.iter()
.step_by(8)
.map(|x| *x.deref() as u8)
.collect()
}