Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

746 B
Raw Blame
use super::SearchResponsePB;
use flowy_derive::{ProtoBuf, ProtoBuf_Enum};

#[derive(ProtoBuf, Default, Debug, Clone)]
pub struct SearchStatePB {
  #[pb(index = 1, one_of)]
  pub response: Option<SearchResponsePB>,

  #[pb(index = 2)]
  pub search_id: String,
}

#[derive(ProtoBuf_Enum, Debug, Default)]
pub enum SearchNotification {
  #[default]
  Unknown = 0,
  DidUpdateResults = 1,
}

impl std::convert::From<SearchNotification> for i32 {
  fn from(notification: SearchNotification) -> Self {
    notification as i32
  }
}

impl std::convert::From<i32> for SearchNotification {
  fn from(notification: i32) -> Self {
    match notification {
      1 => SearchNotification::DidUpdateResults,
      _ => SearchNotification::Unknown,
    }
  }
}