2021-05-09 05:26:59 +04:30
|
|
|
trait Hello {
|
2024-04-05 23:27:58 +00:00
|
|
|
fn example(&self, input: &i32);
|
2021-05-09 05:26:59 +04:30
|
|
|
}
|
|
|
|
|
|
|
|
struct Test1(i32);
|
|
|
|
|
|
|
|
impl Hello for Test1 {
|
2024-04-05 23:27:58 +00:00
|
|
|
fn example(&self, input: &i32) {
|
2021-05-11 08:50:43 +04:30
|
|
|
*input = self.0; //~ ERROR cannot assign
|
2021-05-09 05:26:59 +04:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Test2(i32);
|
|
|
|
|
|
|
|
impl Hello for Test2 {
|
2024-04-05 23:27:58 +00:00
|
|
|
fn example(&self, input: &i32) {
|
2021-05-11 08:50:43 +04:30
|
|
|
self.0 += *input; //~ ERROR cannot assign
|
2021-05-09 05:26:59 +04:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() { }
|