Skip to main content

Term

Struct Term 

Source
pub struct Term {
    pub name: String,
    pub kind: MembershipKind,
}

Fields§

§name: String§kind: MembershipKind

Implementations§

Source§

impl Term

Source

pub fn new(name: impl Into<String>, kind: MembershipKind) -> Self

Examples found in repository?
examples/restaurant_tip_level.rs (lines 19-26)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Fuzzy logic based TIP system");
11
12    let mut tip = LinguisticVariable::new(
13        "tip",
14        Range {
15            min: 0.0,
16            max: 30.0,
17        },
18    );
19    tip.add_term(Term::new(
20        "small",
21        M::Triangle {
22            a: 0.0,
23            b: 5.0,
24            c: 10.0,
25        },
26    ));
27    tip.add_term(Term::new(
28        "average",
29        M::Triangle {
30            a: 10.0,
31            b: 15.0,
32            c: 20.0,
33        },
34    ));
35    tip.add_term(Term::new(
36        "generous",
37        M::Triangle {
38            a: 20.0,
39            b: 25.0,
40            c: 30.0,
41        },
42    ));
43    system.add_output(tip);
44
45    let mut service = LinguisticVariable::new(
46        "service",
47        Range {
48            min: 0.0,
49            max: 10.0,
50        },
51    );
52    service.add_term(Term::new(
53        "poor",
54        M::Gauss {
55            sigma: 2.123,
56            mu: 0.0,
57        },
58    ));
59    service.add_term(Term::new(
60        "normal",
61        M::Gauss {
62            sigma: 2.123,
63            mu: 5.0,
64        },
65    ));
66    service.add_term(Term::new(
67        "excellent",
68        M::Gauss {
69            sigma: 2.123,
70            mu: 10.0,
71        },
72    ));
73    system.add_input(service);
74
75    let mut food = LinguisticVariable::new(
76        "food",
77        Range {
78            min: 0.0,
79            max: 10.0,
80        },
81    );
82    food.add_term(Term::new(
83        "bad",
84        M::Trapezoid {
85            a: 0.0,
86            b: 0.0,
87            c: 1.0,
88            d: 3.0,
89        },
90    ));
91    food.add_term(Term::new(
92        "good",
93        M::Trapezoid {
94            a: 7.0,
95            b: 9.0,
96            c: 10.0,
97            d: 10.0,
98        },
99    ));
100    system.add_input(food);
101
102    system.set_rules(vec![
103        Rule::new(
104            vec![Some("poor".into()), Some("bad".into())],
105            vec!["small".into()],
106            Connective::And,
107        ),
108        Rule::new(
109            vec![Some("normal".into()), None],
110            vec!["average".into()],
111            Connective::And,
112        ),
113        Rule::new(
114            vec![Some("excellent".into()), Some("good".into())],
115            vec!["generous".into()],
116            Connective::And,
117        ),
118    ]);
119
120    let result = system.compute(FisType::Mamdani, &[7.892, 7.41])?;
121    println!("{result:?}");
122    assert!(result[0] > 18.0);
123    assert!(result[0] < 19.0);
124
125    Ok(())
126}
More examples
Hide additional examples
examples/steering_wheel_in_autonomous_car.rs (lines 20-27)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Autonomous steering by fuzzy logic");
11
12    // Output: steering angle (negative = left, positive = right)
13    let mut steering = LinguisticVariable::new(
14        "steering",
15        Range {
16            min: -30.0,
17            max: 30.0,
18        },
19    );
20    steering.add_term(Term::new(
21        "left",
22        M::Triangle {
23            a: -30.0,
24            b: -20.0,
25            c: -10.0,
26        },
27    ));
28    steering.add_term(Term::new(
29        "straight",
30        M::Triangle {
31            a: -5.0,
32            b: 0.0,
33            c: 5.0,
34        },
35    ));
36    steering.add_term(Term::new(
37        "right",
38        M::Triangle {
39            a: 10.0,
40            b: 20.0,
41            c: 30.0,
42        },
43    ));
44    system.add_output(steering);
45
46    // Input: lane deviation (meters from center)
47    let mut deviation = LinguisticVariable::new(
48        "deviation",
49        Range {
50            min: -2.0,
51            max: 2.0,
52        },
53    );
54    deviation.add_term(Term::new(
55        "left",
56        M::Triangle {
57            a: -2.0,
58            b: -2.0,
59            c: -0.5,
60        },
61    ));
62    deviation.add_term(Term::new(
63        "center",
64        M::Triangle {
65            a: -0.5,
66            b: 0.0,
67            c: 0.5,
68        },
69    ));
70    deviation.add_term(Term::new(
71        "right",
72        M::Triangle {
73            a: 0.5,
74            b: 2.0,
75            c: 2.0,
76        },
77    ));
78    system.add_input(deviation);
79
80    // Input: road curvature (negative = left curve, positive = right curve)
81    let mut curvature = LinguisticVariable::new(
82        "curvature",
83        Range {
84            min: -1.0,
85            max: 1.0,
86        },
87    );
88    curvature.add_term(Term::new(
89        "left",
90        M::Triangle {
91            a: -1.0,
92            b: -1.0,
93            c: -0.3,
94        },
95    ));
96    curvature.add_term(Term::new(
97        "straight",
98        M::Triangle {
99            a: -0.2,
100            b: 0.0,
101            c: 0.2,
102        },
103    ));
104    curvature.add_term(Term::new(
105        "right",
106        M::Triangle {
107            a: 0.3,
108            b: 1.0,
109            c: 1.0,
110        },
111    ));
112    system.add_input(curvature);
113
114    // Rules
115    system.set_rules(vec![
116        Rule::new(
117            vec![Some("left".into()), Some("straight".into())],
118            vec!["right".into()],
119            Connective::And,
120        ),
121        Rule::new(
122            vec![Some("right".into()), Some("straight".into())],
123            vec!["left".into()],
124            Connective::And,
125        ),
126        Rule::new(
127            vec![Some("center".into()), Some("left".into())],
128            vec!["left".into()],
129            Connective::And,
130        ),
131        Rule::new(
132            vec![Some("center".into()), Some("right".into())],
133            vec!["right".into()],
134            Connective::And,
135        ),
136    ]);
137
138    let result = system.compute(FisType::Mamdani, &[-0.8, 0.0])?;
139    println!("Steering decision: {:?}", result);
140    assert!(result[0] > 19.0);
141    assert!(result[0] < 20.0);
142
143    Ok(())
144}
examples/robotic_behaviours__abstacle_avoidance.rs (lines 20-27)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Robot behaviour");
11
12    // Output: speed
13    let mut speed = LinguisticVariable::new(
14        "speed",
15        Range {
16            min: 0.0,
17            max: 100.0,
18        },
19    );
20    speed.add_term(Term::new(
21        "stop",
22        M::Triangle {
23            a: 0.0,
24            b: 0.0,
25            c: 20.0,
26        },
27    ));
28    speed.add_term(Term::new(
29        "slow",
30        M::Triangle {
31            a: 10.0,
32            b: 30.0,
33            c: 50.0,
34        },
35    ));
36    speed.add_term(Term::new(
37        "fast",
38        M::Triangle {
39            a: 50.0,
40            b: 75.0,
41            c: 100.0,
42        },
43    ));
44    system.add_output(speed);
45
46    // Input: distance to obstacle
47    let mut distance = LinguisticVariable::new(
48        "distance",
49        Range {
50            min: 0.0,
51            max: 200.0,
52        },
53    );
54    distance.add_term(Term::new(
55        "near",
56        M::Triangle {
57            a: 0.0,
58            b: 0.0,
59            c: 50.0,
60        },
61    ));
62    distance.add_term(Term::new(
63        "medium",
64        M::Triangle {
65            a: 40.0,
66            b: 100.0,
67            c: 160.0,
68        },
69    ));
70    distance.add_term(Term::new(
71        "far",
72        M::Triangle {
73            a: 120.0,
74            b: 200.0,
75            c: 200.0,
76        },
77    ));
78    system.add_input(distance);
79
80    // Input: battery level
81    let mut battery = LinguisticVariable::new(
82        "battery",
83        Range {
84            min: 0.0,
85            max: 100.0,
86        },
87    );
88    battery.add_term(Term::new(
89        "low",
90        M::Triangle {
91            a: 0.0,
92            b: 0.0,
93            c: 40.0,
94        },
95    ));
96    battery.add_term(Term::new(
97        "medium",
98        M::Triangle {
99            a: 30.0,
100            b: 50.0,
101            c: 70.0,
102        },
103    ));
104    battery.add_term(Term::new(
105        "high",
106        M::Triangle {
107            a: 60.0,
108            b: 100.0,
109            c: 100.0,
110        },
111    ));
112    system.add_input(battery);
113
114    // Rules
115    system.set_rules(vec![
116        Rule::new(
117            vec![Some("near".into()), None],
118            vec!["stop".into()],
119            Connective::And,
120        ),
121        Rule::new(
122            vec![Some("medium".into()), Some("low".into())],
123            vec!["slow".into()],
124            Connective::And,
125        ),
126        Rule::new(
127            vec![Some("far".into()), Some("high".into())],
128            vec!["fast".into()],
129            Connective::And,
130        ),
131    ]);
132
133    // Evaluate
134    let distance_inp = 150.0;
135    let battery_inp = 80.0;
136    let inputs = vec![distance_inp, battery_inp];
137
138    let result = system.compute(FisType::Mamdani, &inputs);
139    let out = result.unwrap();
140
141    println!("Robot speed decision: {:?}", out[0]);
142
143    println!(
144        "Inputs: distance_inp={:?}, battery_inp={:?} => Robot behaviour ≈ {:?}",
145        distance_inp, battery_inp, out
146    );
147    assert!(out[0] > 74.0);
148    assert!(out[0] < 75.0);
149
150    match system.compute_verbose(FisType::Mamdani, &inputs) {
151        Ok(outputs) => {
152            for out in outputs {
153                println!("{}", out.describe());
154            }
155        }
156        Err(e) => eprintln!("compute_verbose() - Error: {}", e),
157    }
158
159    Ok(())
160}
examples/motor_control.rs (lines 20-28)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Motor Control");
11
12    // Define output variable (motor speed)
13    let mut motor = LinguisticVariable::new(
14        "Speed",
15        Range {
16            min: 0.0,
17            max: 2000.0,
18        },
19    );
20    motor.add_term(Term::new(
21        "fast",
22        M::Trapezoid {
23            a: 1000.0,
24            b: 1200.0,
25            c: 1500.0,
26            d: 2000.0,
27        },
28    ));
29    motor.add_term(Term::new(
30        "slow",
31        M::Trapezoid {
32            a: 0.0,
33            b: 0.0,
34            c: 800.0,
35            d: 1200.0,
36        },
37    ));
38    system.add_output(motor);
39
40    // Define input variable: Temperature
41    let mut temp = LinguisticVariable::new(
42        "Temperature",
43        Range {
44            min: -80.0,
45            max: 80.0,
46        },
47    );
48    temp.add_term(Term::new(
49        "cold",
50        M::Trapezoid {
51            a: -80.0,
52            b: -80.0,
53            c: 0.0,
54            d: 20.0,
55        },
56    ));
57    temp.add_term(Term::new(
58        "hot",
59        M::Trapezoid {
60            a: 15.0,
61            b: 20.0,
62            c: 80.0,
63            d: 80.0,
64        },
65    ));
66    system.add_input(temp);
67
68    // Define input variable: Humidity
69    let mut hum = LinguisticVariable::new(
70        "Humidity",
71        Range {
72            min: 0.0,
73            max: 100.0,
74        },
75    );
76    hum.add_term(Term::new(
77        "dry",
78        M::Trapezoid {
79            a: 0.0,
80            b: 0.0,
81            c: 20.0,
82            d: 50.0,
83        },
84    ));
85    hum.add_term(Term::new(
86        "wet",
87        M::Trapezoid {
88            a: 40.0,
89            b: 70.0,
90            c: 100.0,
91            d: 100.0,
92        },
93    ));
94    system.add_input(hum);
95
96    // Rules
97    // IF temp is hot AND hum is dry THEN motor is fast
98    let r1 = Rule::new(
99        vec![Some("hot".into()), Some("dry".into())],
100        vec!["fast".into()],
101        Connective::And,
102    );
103
104    // IF temp is cold AND hum is dry THEN motor is very slow (approximate hedge by reusing "slow")
105    let r2 = Rule::new(
106        vec![Some("cold".into()), Some("dry".into())],
107        vec!["slow".into()],
108        Connective::And,
109    );
110
111    // IF temp is hot AND hum is wet THEN motor is very fast (approximate hedge by reusing "fast")
112    let r3 = Rule::new(
113        vec![Some("hot".into()), Some("wet".into())],
114        vec!["fast".into()],
115        Connective::And,
116    );
117
118    // IF temp is cold AND hum is wet THEN motor is slow
119    let r4 = Rule::new(
120        vec![Some("cold".into()), Some("wet".into())],
121        vec!["slow".into()],
122        Connective::And,
123    );
124
125    system.set_rules(vec![r1, r2, r3, r4]);
126
127    // Evaluate
128    let temp = 42.0;
129    let hum = 45.0;
130    let inputs = vec![temp, hum];
131
132    let result = system.compute(FisType::Mamdani, &inputs);
133    let out = result.unwrap();
134    println!(
135        "Inputs: temp={:?}, hum={:?} => motor speed ≈ {:?}",
136        temp, hum, out
137    );
138    assert!(out[0] > 1480.0);
139    assert!(out[0] < 1490.0);
140
141    match system.compute_verbose(FisType::Mamdani, &inputs) {
142        Ok(outputs) => {
143            for out in outputs {
144                println!("{}", out.describe());
145            }
146        }
147        Err(e) => eprintln!("compute_verbose() - Error: {}", e),
148    }
149
150    Ok(())
151}
examples/private_financial_decisions_at_home.rs (lines 20-27)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Home finance advisor");
11
12    // Output: savings rate (% of income)
13    let mut savings = LinguisticVariable::new(
14        "savings",
15        Range {
16            min: 0.0,
17            max: 50.0,
18        },
19    );
20    savings.add_term(Term::new(
21        "low",
22        M::Triangle {
23            a: 0.0,
24            b: 5.0,
25            c: 15.0,
26        },
27    ));
28    savings.add_term(Term::new(
29        "medium",
30        M::Triangle {
31            a: 10.0,
32            b: 20.0,
33            c: 30.0,
34        },
35    ));
36    savings.add_term(Term::new(
37        "high",
38        M::Triangle {
39            a: 25.0,
40            b: 40.0,
41            c: 50.0,
42        },
43    ));
44    system.add_output(savings);
45
46    // Input: income stability (0 = unstable, 10 = very stable)
47    let mut stability = LinguisticVariable::new(
48        "stability",
49        Range {
50            min: 0.0,
51            max: 10.0,
52        },
53    );
54    stability.add_term(Term::new(
55        "unstable",
56        M::Triangle {
57            a: 0.0,
58            b: 0.0,
59            c: 4.0,
60        },
61    ));
62    stability.add_term(Term::new(
63        "moderate",
64        M::Triangle {
65            a: 3.0,
66            b: 5.0,
67            c: 7.0,
68        },
69    ));
70    stability.add_term(Term::new(
71        "stable",
72        M::Triangle {
73            a: 6.0,
74            b: 10.0,
75            c: 10.0,
76        },
77    ));
78    system.add_input(stability);
79
80    // Input: current expenses (% of income)
81    let mut expenses = LinguisticVariable::new(
82        "expenses",
83        Range {
84            min: 0.0,
85            max: 100.0,
86        },
87    );
88    expenses.add_term(Term::new(
89        "low",
90        M::Triangle {
91            a: 0.0,
92            b: 20.0,
93            c: 40.0,
94        },
95    ));
96    expenses.add_term(Term::new(
97        "medium",
98        M::Triangle {
99            a: 30.0,
100            b: 50.0,
101            c: 70.0,
102        },
103    ));
104    expenses.add_term(Term::new(
105        "high",
106        M::Triangle {
107            a: 60.0,
108            b: 80.0,
109            c: 100.0,
110        },
111    ));
112    system.add_input(expenses);
113
114    // Rules
115    system.set_rules(vec![
116        // If income is stable and expenses are low -> save high
117        Rule::new(
118            vec![Some("stable".into()), Some("low".into())],
119            vec!["high".into()],
120            Connective::And,
121        ),
122        // If income is moderate and expenses are medium -> save medium
123        Rule::new(
124            vec![Some("moderate".into()), Some("medium".into())],
125            vec!["medium".into()],
126            Connective::And,
127        ),
128        // If income is unstable or expenses are high -> save low
129        Rule::new(
130            vec![Some("unstable".into()), None],
131            vec!["low".into()],
132            Connective::Or,
133        ),
134        Rule::new(
135            vec![None, Some("high".into())],
136            vec!["low".into()],
137            Connective::Or,
138        ),
139    ]);
140
141    // Evaluate
142    let stable_income = 8.0; // (8/10)
143    let medium_expenses = 45.0; // 45%
144    let inputs = vec![stable_income, medium_expenses];
145
146    let result = system.compute(FisType::Mamdani, &inputs);
147    let out = result.unwrap();
148
149    println!("Suggested savings rate: {:.2}%", out[0]);
150
151    println!(
152        "Inputs: stable_income={:?}, medium_expenses={:?} => Home finance advisor ≈ {:?}",
153        stable_income, medium_expenses, out
154    );
155    assert!(out[0] > 6.0);
156    assert!(out[0] < 7.0);
157
158    match system.compute_verbose(FisType::Mamdani, &inputs) {
159        Ok(outputs) => {
160            for out in outputs {
161                println!("{}", out.describe());
162            }
163        }
164        Err(e) => eprintln!("compute_verbose() - Error: {}", e),
165    }
166
167    Ok(())
168}
examples/smart_office_energy_management.rs (lines 20-27)
9fn main() -> Result<(), Box<dyn std::error::Error>> {
10    let mut system = FuzzyInferenceSystem::new("Smart Office Energy Management (HVAC controller)");
11
12    // Output: HVAC intensity (0 = off, 100 = max)
13    let mut hvac = LinguisticVariable::new(
14        "hvac",
15        Range {
16            min: 0.0,
17            max: 100.0,
18        },
19    );
20    hvac.add_term(Term::new(
21        "low",
22        M::Triangle {
23            a: 0.0,
24            b: 0.0,
25            c: 40.0,
26        },
27    ));
28    hvac.add_term(Term::new(
29        "medium",
30        M::Triangle {
31            a: 30.0,
32            b: 50.0,
33            c: 70.0,
34        },
35    ));
36    hvac.add_term(Term::new(
37        "high",
38        M::Triangle {
39            a: 60.0,
40            b: 100.0,
41            c: 100.0,
42        },
43    ));
44    system.add_output(hvac);
45
46    // Input: occupancy (0 = empty, 100 = full)
47    let mut occupancy = LinguisticVariable::new(
48        "occupancy",
49        Range {
50            min: 0.0,
51            max: 100.0,
52        },
53    );
54    occupancy.add_term(Term::new(
55        "low",
56        M::Triangle {
57            a: 0.0,
58            b: 0.0,
59            c: 40.0,
60        },
61    ));
62    occupancy.add_term(Term::new(
63        "medium",
64        M::Triangle {
65            a: 30.0,
66            b: 50.0,
67            c: 70.0,
68        },
69    ));
70    occupancy.add_term(Term::new(
71        "high",
72        M::Triangle {
73            a: 60.0,
74            b: 100.0,
75            c: 100.0,
76        },
77    ));
78    system.add_input(occupancy);
79
80    // Input: outside temperature (°C, -10 to 40)
81    let mut temperature = LinguisticVariable::new(
82        "temperature",
83        Range {
84            min: -10.0,
85            max: 40.0,
86        },
87    );
88    temperature.add_term(Term::new(
89        "cold",
90        M::Triangle {
91            a: -10.0,
92            b: -10.0,
93            c: 10.0,
94        },
95    ));
96    temperature.add_term(Term::new(
97        "mild",
98        M::Triangle {
99            a: 5.0,
100            b: 20.0,
101            c: 25.0,
102        },
103    ));
104    temperature.add_term(Term::new(
105        "hot",
106        M::Triangle {
107            a: 20.0,
108            b: 40.0,
109            c: 40.0,
110        },
111    ));
112    system.add_input(temperature);
113
114    // Input: energy price (0 = very cheap, 100 = very expensive)
115    let mut price = LinguisticVariable::new(
116        "price",
117        Range {
118            min: 0.0,
119            max: 100.0,
120        },
121    );
122    price.add_term(Term::new(
123        "low",
124        M::Triangle {
125            a: 0.0,
126            b: 0.0,
127            c: 40.0,
128        },
129    ));
130    price.add_term(Term::new(
131        "medium",
132        M::Triangle {
133            a: 30.0,
134            b: 50.0,
135            c: 70.0,
136        },
137    ));
138    price.add_term(Term::new(
139        "high",
140        M::Triangle {
141            a: 60.0,
142            b: 100.0,
143            c: 100.0,
144        },
145    ));
146    system.add_input(price);
147
148    // Rules
149    system.set_rules(vec![
150        // If occupancy is high and temperature is hot -> HVAC high
151        Rule::new(
152            vec![Some("high".into()), Some("hot".into()), None],
153            vec!["high".into()],
154            Connective::And,
155        ),
156        // If occupancy is low and price is high -> HVAC low
157        Rule::new(
158            vec![Some("low".into()), None, Some("high".into())],
159            vec!["low".into()],
160            Connective::And,
161        ),
162        // If occupancy is medium and temperature is mild -> HVAC medium
163        Rule::new(
164            vec![Some("medium".into()), Some("mild".into()), None],
165            vec!["medium".into()],
166            Connective::And,
167        ),
168        // If price is low -> HVAC can be generous (medium or high)
169        Rule::new(
170            vec![None, None, Some("low".into())],
171            vec!["high".into()],
172            Connective::Or,
173        ),
174    ]);
175
176    // Example scenario: 70% occupancy, 28°C outside, price = 65
177    let result = system.compute(FisType::Mamdani, &[70.0, 28.0, 65.0])?;
178    println!("HVAC intensity decision: {:.2}%", result[0]);
179    assert!(result[0] > 86.0);
180
181    Ok(())
182}
Source

pub fn degree(&self, x: f64) -> f64

Source

pub fn membership(&self, x: &Vec<f64>) -> f64

Trait Implementations§

Source§

impl Clone for Term

Source§

fn clone(&self) -> Term

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Term

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Term

§

impl RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl UnsafeUnpin for Term

§

impl UnwindSafe for Term

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.