Lexicon Module, codegen current lexicons
Use esquema (github:fatfingers23/esquema@9ef00b9) to generate rust code
for the lexicons that we have.
Currently, esquema doesn't seem to support top level integer types. I've
opted to temporarily remove `indexProgress` from my.spoor.log.activity
while compiling, and then adding it back afterwards.
I could compile esquema with the following added to my flake.nix
```
nativeBuildInputs = with pkgs; [
pkg-config
openssl
openssl.dev
];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
```
at a later date I will add it as a dependency, but I spent a while
trying to package esquema to no results.
This commit is contained in:
parent
0210da9708
commit
090cb6631e
11 changed files with 245 additions and 0 deletions
65
src/lexicons/record.rs
Normal file
65
src/lexicons/record.rs
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
// @generated - This file is generated by esquema-codegen (forked from atrium-codegen). DO NOT EDIT.
|
||||
//!A collection of known record types.
|
||||
#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||
#[serde(tag = "$type")]
|
||||
pub enum KnownRecord {
|
||||
#[serde(rename = "my.spoor.content.external")]
|
||||
LexiconsMySpoorContentExternal(
|
||||
Box<crate::lexicons::my::spoor::content::external::Record>,
|
||||
),
|
||||
#[serde(rename = "my.spoor.content.media")]
|
||||
LexiconsMySpoorContentMedia(Box<crate::lexicons::my::spoor::content::media::Record>),
|
||||
#[serde(rename = "my.spoor.log.activity")]
|
||||
LexiconsMySpoorLogActivity(Box<crate::lexicons::my::spoor::log::activity::Record>),
|
||||
#[serde(rename = "my.spoor.log.session")]
|
||||
LexiconsMySpoorLogSession(Box<crate::lexicons::my::spoor::log::session::Record>),
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::content::external::Record> for KnownRecord {
|
||||
fn from(record: crate::lexicons::my::spoor::content::external::Record) -> Self {
|
||||
KnownRecord::LexiconsMySpoorContentExternal(Box::new(record))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::content::external::RecordData> for KnownRecord {
|
||||
fn from(
|
||||
record_data: crate::lexicons::my::spoor::content::external::RecordData,
|
||||
) -> Self {
|
||||
KnownRecord::LexiconsMySpoorContentExternal(Box::new(record_data.into()))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::content::media::Record> for KnownRecord {
|
||||
fn from(record: crate::lexicons::my::spoor::content::media::Record) -> Self {
|
||||
KnownRecord::LexiconsMySpoorContentMedia(Box::new(record))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::content::media::RecordData> for KnownRecord {
|
||||
fn from(
|
||||
record_data: crate::lexicons::my::spoor::content::media::RecordData,
|
||||
) -> Self {
|
||||
KnownRecord::LexiconsMySpoorContentMedia(Box::new(record_data.into()))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::log::activity::Record> for KnownRecord {
|
||||
fn from(record: crate::lexicons::my::spoor::log::activity::Record) -> Self {
|
||||
KnownRecord::LexiconsMySpoorLogActivity(Box::new(record))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::log::activity::RecordData> for KnownRecord {
|
||||
fn from(record_data: crate::lexicons::my::spoor::log::activity::RecordData) -> Self {
|
||||
KnownRecord::LexiconsMySpoorLogActivity(Box::new(record_data.into()))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::log::session::Record> for KnownRecord {
|
||||
fn from(record: crate::lexicons::my::spoor::log::session::Record) -> Self {
|
||||
KnownRecord::LexiconsMySpoorLogSession(Box::new(record))
|
||||
}
|
||||
}
|
||||
impl From<crate::lexicons::my::spoor::log::session::RecordData> for KnownRecord {
|
||||
fn from(record_data: crate::lexicons::my::spoor::log::session::RecordData) -> Self {
|
||||
KnownRecord::LexiconsMySpoorLogSession(Box::new(record_data.into()))
|
||||
}
|
||||
}
|
||||
impl Into<atrium_api::types::Unknown> for KnownRecord {
|
||||
fn into(self) -> atrium_api::types::Unknown {
|
||||
atrium_api::types::TryIntoUnknown::try_into_unknown(&self).unwrap()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue