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

33 lines
937 B
Rust

use crate::event_handler::*;
use crate::DocumentManager;
use flowy_derive::{Flowy_Event, ProtoBuf_Enum};
use lib_dispatch::prelude::AFPlugin;
use std::sync::Arc;
use strum_macros::Display;
pub fn init(document_manager: Arc<DocumentManager>) -> AFPlugin {
let mut plugin = AFPlugin::new()
.name(env!("CARGO_PKG_NAME"))
.state(document_manager);
plugin = plugin
.event(DocumentEvent::GetDocument, get_document_handler)
.event(DocumentEvent::ApplyEdit, apply_edit_handler)
.event(DocumentEvent::ExportDocument, export_handler);
plugin
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, Hash, ProtoBuf_Enum, Flowy_Event)]
#[event_err = "FlowyError"]
pub enum DocumentEvent {
#[event(input = "OpenDocumentPayloadPB", output = "DocumentDataPB")]
GetDocument = 0,
#[event(input = "EditPayloadPB")]
ApplyEdit = 1,
#[event(input = "ExportPayloadPB", output = "ExportDataPB")]
ExportDocument = 2,
}