refactor: clean code & fix suffix computation & combine export actors (#263)

* dev: use bail! macro

* dev: remove redundant arg structures as we have inlay hints

* dev: unify actor namings

* dev: unify actor namings (cont)

* fix: suffix computation

* dev: add EditorActor::new

* dev: unify index file flavors

* dev: combine export actors

* dev: small tweaks

* dev: mimic try blocks

* dev: accumulate export requests

* dev: remove unnecessary Option

* dev: unify serde renames

* dev: remove unnecessary Option

* dev: small tweaks
This commit is contained in:
QuarticCat 2024-05-09 08:57:44 +08:00 committed by GitHub
parent d05c5012ff
commit 94a0a1b23a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 663 additions and 1036 deletions

View file

@ -132,17 +132,15 @@ mod polymorphic {
use super::*;
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PageSelection {
#[serde(rename = "first")]
First,
#[serde(rename = "merged")]
Merged,
}
#[derive(Debug, Clone)]
pub enum ExportKind {
Pdf,
WordCount,
Svg { page: PageSelection },
Png { page: PageSelection },
}
@ -151,7 +149,6 @@ mod polymorphic {
pub fn extension(&self) -> &str {
match self {
Self::Pdf => "pdf",
Self::WordCount => "txt",
Self::Svg { .. } => "svg",
Self::Png { .. } => "png",
}
@ -179,12 +176,11 @@ mod polymorphic {
pub struct ServerInfoRequest {}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ServerInfoResponse {
pub root: Option<PathBuf>,
#[serde(rename = "fontPaths")]
pub font_paths: Vec<PathBuf>,
pub inputs: Dict,
#[serde(rename = "estimatedMemoryUsage")]
pub estimated_memory_usage: HashMap<String, usize>,
}