Nathan.fooo 6bb1c4e89c
feat: run rustfmt with custom defined fmt configuration (#1848)
* chore: update rustfmt

* chore: apply rustfmt format
2023-02-13 09:29:49 +08:00

26 lines
586 B
Rust

use allo_isolate::Isolate;
use bytes::Bytes;
use flowy_notification::entities::SubscribeObject;
use flowy_notification::NotificationSender;
use std::convert::TryInto;
pub struct DartNotificationSender {
isolate: Isolate,
}
impl DartNotificationSender {
pub fn new(port: i64) -> Self {
Self {
isolate: Isolate::new(port),
}
}
}
impl NotificationSender for DartNotificationSender {
fn send_subject(&self, subject: SubscribeObject) -> Result<(), String> {
let bytes: Bytes = subject.try_into().unwrap();
self.isolate.post(bytes.to_vec());
Ok(())
}
}