Groundwork for integrating Specta (#949)

* add derive(specta::Type)

* use specta from git

* introduce Uuid type

* remove unnecessary specta::Type

* document export_types test

* upgrade Specta
The previous Specta branch had some hacks that were just for this project. They have all been converted into proper features so they can be merged into main.

* remove some unnecessary specta::Type uses

* add MessageDiscriminantDef explanation

* manually export types with specta

* rename 'specta.rs' to 'export_types.rs'

* rename 'export_types' to 'generate_ts_types'

---------

Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
This commit is contained in:
Brendan Allan
2023-01-28 22:29:38 -08:00
committed by Keavon Chambers
co-authored by Oscar Beaumont
parent e0146d57f7
commit 5388b59e97
72 changed files with 286 additions and 140 deletions
@@ -2,7 +2,7 @@ use dyn_any::{DynAny, StaticType};
use glam::DVec2;
use std::fmt::Debug;
#[derive(Default, Debug, Clone, Copy, PartialEq, DynAny)]
#[derive(Default, Debug, Clone, Copy, PartialEq, DynAny, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ImaginateStatus {
#[default]
@@ -14,7 +14,7 @@ pub enum ImaginateStatus {
Terminated,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ImaginateBaseImage {
pub mime: String,
@@ -23,7 +23,7 @@ pub struct ImaginateBaseImage {
pub size: DVec2,
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ImaginateMaskImage {
pub svg: String,
@@ -31,7 +31,7 @@ pub struct ImaginateMaskImage {
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, specta::Type)]
pub enum ImaginateMaskPaintMode {
#[default]
Inpaint,
@@ -39,7 +39,7 @@ pub enum ImaginateMaskPaintMode {
}
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny)]
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, DynAny, specta::Type)]
pub enum ImaginateMaskStartingFill {
#[default]
Fill,
@@ -70,7 +70,7 @@ impl std::fmt::Display for ImaginateMaskStartingFill {
}
}
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, DynAny)]
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, DynAny, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum ImaginateSamplingMethod {
#[default]
@@ -163,7 +163,7 @@ impl std::fmt::Display for ImaginateSamplingMethod {
}
}
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, specta::Type)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ImaginateGenerationParameters {
pub seed: u64,