AK
В общем-то подобный код и в C\C++ ничего хорошего бы не делал =)
сейчас попробую
В общем-то подобный код и в C\C++ ничего хорошего бы не делал =)
та я тока пытаюсь тыкать, тестовый проект пытаюсь запилить)
Size: a a a
AK
AK
(x, y, pixel)
- pixel*pixel = Rgba([255, 0, 0, 255]);
KK
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
AK
NL
JM
NL
JM
NL
JM
..B2
, если по аналогии с CEFRDT
NL
E
pub trait PushNotifications<'a>: Send + Sync + 'static {
type SubscribeToPushNotificationsStream<'a>: Stream<Item = Result<NotificationResponse, Status>>+ Send + Sync + 'static;
async fn subscribe_to_push_notifications<'a>(
&'a mut self,
request: tonic::Request<NotificationRequest>,
) -> Result<tonic::Response<Self::SubscribeToPushNotificationsStream<'a>>, Status>;
}
E
li
MB
pub trait PushNotifications<'a>: Send + Sync + 'static {
type SubscribeToPushNotificationsStream<'a>: Stream<Item = Result<NotificationResponse, Status>>+ Send + Sync + 'static;
async fn subscribe_to_push_notifications<'a>(
&'a mut self,
request: tonic::Request<NotificationRequest>,
) -> Result<tonic::Response<Self::SubscribeToPushNotificationsStream<'a>>, Status>;
}
E
MB
E
MB