tauri-plugin-polygon 0.1.2

A plugin for [tauri@v2](https://tauri.app/) to achieve click-through of the tauri main window by allowing developers to define polygons, thus customizing the mouse response area.
Documentation
use serde::{Deserialize, Serialize};

use crate::error::Error;

pub(crate) type CommandResult = Result<Response, Response>;

#[derive(Debug, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Response {
    ok: bool,
    error: Option<String>,
}

impl Response {
    pub(crate) fn ok() -> CommandResult {
        Ok(Self {
            ok: true,
            error: None,
        })
    }
    pub(crate) fn err(error: Error) -> CommandResult {
        Err(Self {
            ok: false,
            error: Some(error.to_string()),
        })
    }
}