АК
a = [1, 2, 3, 4]
b = [2, 3]
b in a == True
Size: a a a
АК
Z
MB
MB
MB
K
sn
DO
b.iter().all(|a_item| a.contains(a_item))JM
b.iter().all(|a_item| a.contains(a_item))n, что a.iter().skip(n).zip(b.iter()).all(|(i, j)| i == j)JM
n, что a.iter().skip(n).zip(b.iter()).all(|(i, j)| i == j)JM
С
r
С
r
let i = RefCell::new(1); и в замыкании let mut i = i.borrow_mut(); *i += 1; и т.д.r
С
let i = RefCell::new(1); и в замыкании let mut i = i.borrow_mut(); *i += 1; и т.д.i.borrow_mut() += 1AK
for (x, y, pixel) in diff.enumerate_pixels_mut() {
let pixel_1 = liza_1.get_pixel(x, y);
let pixel_2 = liza_2.get_pixel(x, y);
if pixel_1 != pixel_2 {
let delta: f64 = delta(pixel_1, pixel_2);
if delta > MAX_DELTA {
diff.put_pixel(x, y, Rgba([255, 0, 0, 255]));
diff_pixels_counter += 1
}
} else {
diff.put_pixel(x, y, *pixel_1)
}
}
Получаю ошибку:error[E0499]: cannot borrow `diff` as mutable more than once at a timeкак побороть это?
--> src\main.rs:65:13
|
50 | for (x, y, pixel) in diff.enumerate_pixels_mut() {
| ---------------------------
| |
| first mutable borrow occurs here
| first borrow later used here
...
65 | diff.put_pixel(x, y, *pixel_1)
| ^^^^ second mutable borrow occurs here
𝕯𝖁
OS
for (x, y, pixel) in diff.enumerate_pixels_mut() {
let pixel_1 = liza_1.get_pixel(x, y);
let pixel_2 = liza_2.get_pixel(x, y);
if pixel_1 != pixel_2 {
let delta: f64 = delta(pixel_1, pixel_2);
if delta > MAX_DELTA {
diff.put_pixel(x, y, Rgba([255, 0, 0, 255]));
diff_pixels_counter += 1
}
} else {
diff.put_pixel(x, y, *pixel_1)
}
}
Получаю ошибку:error[E0499]: cannot borrow `diff` as mutable more than once at a timeкак побороть это?
--> src\main.rs:65:13
|
50 | for (x, y, pixel) in diff.enumerate_pixels_mut() {
| ---------------------------
| |
| first mutable borrow occurs here
| first borrow later used here
...
65 | diff.put_pixel(x, y, *pixel_1)
| ^^^^ second mutable borrow occurs here