move dsl's to rhailib wip

This commit is contained in:
Timur Gordon
2025-06-24 19:23:27 +02:00
parent e2640b9421
commit cd2557c1c3
12 changed files with 161 additions and 65 deletions

View File

@@ -0,0 +1,44 @@
use std::sync::Arc;
use crate::db::{hero::OurDB, Collection, Db};
use heromodels_core::BaseModelData;
use heromodels_derive::model;
// Temporarily removed to fix compilation issues
// use rhai_autobind_macros::rhai_model_export;
use rhai::{CustomType, TypeBuilder};
use serde::{Deserialize, Serialize};
/// Represents an event in a contact
#[model]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, CustomType, Default)]
pub struct Object {
/// Base model data
pub base_data: BaseModelData,
#[index]
pub title: String,
pub description: String
}
impl Object {
pub fn new() -> Self {
Object {
title: String::new(),
base_data: BaseModelData::new(),
description: String::new(),
}
}
pub fn id(&self) -> u32 {
self.base_data.id
}
pub fn title(mut self, title: String) -> Self {
self.title = title;
self
}
pub fn description(mut self, description: String) -> Self {
self.description = description;
self
}
}