feat(cheatsheet): remove list of position errors
This commit is contained in:
parent
631db86420
commit
7d2049b59d
|
@ -5,21 +5,6 @@ use crate::{
|
||||||
model::models::*,
|
model::models::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// **Синдромы**
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 1 false true true.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 2 false false true.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 3 true false true.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 4 false true false.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 5 true true false.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 6 true false false.
|
|
||||||
///
|
|
||||||
/// ошибочная позиция 7 false false false.
|
|
||||||
|
|
||||||
pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String> {
|
pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String> {
|
||||||
let length_of_code: usize = mode.clone() as usize;
|
let length_of_code: usize = mode.clone() as usize;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
pub trait Product<B, T> {
|
pub trait Product<B, T> {
|
||||||
fn builder() -> B;
|
fn builder() -> B;
|
||||||
|
|
||||||
fn get(self) -> T;
|
fn get(&self) -> &T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub trait Builder<T, I, P> {
|
pub trait Builder<T, I, P> {
|
||||||
fn build(&self, build_arg: P) -> T;
|
fn build(&self, build_arg: P) -> T;
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,19 @@ pub mod builder_traits;
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
use crate::gtk::glib;
|
use crate::gtk::glib;
|
||||||
|
|
||||||
use glib::Object;
|
use glib::Object;
|
||||||
|
|
||||||
glib::wrapper! {
|
glib::wrapper! {
|
||||||
pub struct ResultValue(ObjectSubclass<models::ResultValue>);
|
pub struct Frequency(ObjectSubclass<models::Frequency>);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResultValue {
|
impl Frequency {
|
||||||
pub fn new(val: f64) -> Self {
|
pub fn new(frequency: f64) -> Self {
|
||||||
Object::builder().property("value", val).build()
|
Object::builder().property("frequency", frequency).build()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn default() -> Self {
|
||||||
|
Object::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,11 @@ use std::cell::Cell;
|
||||||
|
|
||||||
use crate::gtk;
|
use crate::gtk;
|
||||||
|
|
||||||
use glib::Properties;
|
use gtk::{
|
||||||
use gtk::glib;
|
glib::{self, Properties},
|
||||||
use gtk::prelude::*;
|
prelude::*,
|
||||||
use gtk::subclass::prelude::*;
|
subclass::prelude::*,
|
||||||
|
};
|
||||||
|
|
||||||
#[repr(usize)]
|
#[repr(usize)]
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -14,33 +15,29 @@ pub enum HammingMode {
|
||||||
Decrypt = 7,
|
Decrypt = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct EventHandler<F, C> {
|
#[allow(dead_code)]
|
||||||
pub(crate) component: C,
|
#[derive(Default, Copy, Clone, Debug)]
|
||||||
pub(crate) callback: F,
|
pub struct SignalReduce {
|
||||||
}
|
pub length: f64,
|
||||||
|
pub wire_resistance: f64,
|
||||||
#[derive(Default, Copy, Clone)]
|
pub wire_capacity: f64,
|
||||||
pub struct SignalReduce(pub f64, pub f64, pub f64, pub f64, pub f64, pub f64);
|
pub source_voltage: f64,
|
||||||
|
pub source_resistance: f64,
|
||||||
impl SignalReduce {
|
pub frequency: f64,
|
||||||
pub fn new() -> Self {
|
|
||||||
Self(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Properties, Default)]
|
#[derive(Properties, Default)]
|
||||||
#[properties(wrapper_type = super::ResultValue)]
|
#[properties(wrapper_type = super::Frequency)]
|
||||||
pub struct ResultValue {
|
pub struct Frequency {
|
||||||
#[property(get, set)]
|
#[property(get, set)]
|
||||||
value: Cell<f64>,
|
frequency: Cell<f64>,
|
||||||
}
|
|
||||||
|
|
||||||
// The central trait for subclassing a GObject
|
|
||||||
#[glib::object_subclass]
|
|
||||||
impl ObjectSubclass for ResultValue {
|
|
||||||
const NAME: &'static str = "MyGtkAppCustomButton";
|
|
||||||
type Type = super::ResultValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::derived_properties]
|
#[glib::derived_properties]
|
||||||
impl ObjectImpl for ResultValue {}
|
impl ObjectImpl for Frequency {}
|
||||||
|
|
||||||
|
#[glib::object_subclass]
|
||||||
|
impl ObjectSubclass for Frequency {
|
||||||
|
const NAME: &'static str = "FrequencyValue";
|
||||||
|
type Type = super::Frequency;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue