ruwebframe 0.1.8

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation

use crate::rubase::{BaseEntity, JsonEntity};
use crate::rulog;
use serde::{Deserialize, Serialize};
use std::fmt::Display;
use std::sync::Mutex;
use displaydoc::Display;
use crate::rubase::get_self::GetSelf;

#[derive(Serialize, Default, Display,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 Display for Person {
     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(f, "{}", self.to_json().unwrap())
     }
 }

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

        rulog::info(self.to_json().unwrap());
        self
    }
    pub fn new_mutex() ->Mutex< Person> {
        Mutex::new(Person::default())
    }
    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,
        }
    }
}