ruwebframe 0.1.3

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
use crate::rubase::rutils::jsonutils;
use crate::rubase::BaseEntity;
use crate::rulog;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::fmt::Debug;
use crate::rubase::getself::GetSelf;

#[derive(Serialize, Default, Deserialize, Debug, Clone)]
pub struct Person {
    pub id: i64,
    pub name: String,
    pub age: u16,
    pub active: bool,
}
// 普通实体
//impl_base_entity!(Person);
impl BaseEntity for Person {}
impl GetSelf for Person {}


impl fmt::Display for Person {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let result = jsonutils::struct2json(&self);
        //  convert_to_fmt_result(r)
        match result {
            Ok(data) => {
                // 处理数据
                println!("成功: {:?}", data);
                crate::rulog::rulog::info(data.as_str());
                Ok(())
            }
            Err(e) => {
                eprintln!("JSON 解析失败: {}", e);
                Err(fmt::Error) // 转换为 fmt::Error
            }
        }
    }
}

impl Person {
    pub fn log(&self) -> &Person {

        rulog::info(self.to_json().as_str());
        self
    }

    pub fn new() -> Person {
        Person::default()
    }
    pub fn new_as(id: i64, name: String, age: u16, active: bool) -> Person {
        Person {
            //rustEntity: RustEntity {},
            id,
            name,
            age,
            active,
        }
    }
}