ruwebframe 0.1.2

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
pub struct LogInfo {
    content:Vec<u8>,
}


impl LogInfo {
    pub fn new( ) -> LogInfo {
        LogInfo {
            content:Vec::new(),
        }
    }
    // 返回 Self,而不是引用
    pub fn new_msg(msg: &str) -> Self {
        let mut log = Self::new();
        log.content.extend(msg.as_bytes());
        log
    }
    pub fn extend(&mut self, msg: &str) -> &mut Self {
        self.content.extend(msg.as_bytes());
        self
    }
    // 合并多个信息为字符串
    pub fn merge_to_string(&self, separator: &str) -> String {
        self.content
            .iter()
            .map(|&b| b as char)
            .collect::<String>()
    }

    // 或者作为 Vec<u8> 直接转换
    pub fn to_string_lossy(&self) -> String {
        String::from_utf8_lossy(&self.content).to_string()
    }

    // 合并多个 LogInfo
    pub fn merge_multiple(logs: &[&LogInfo], separator: &str) -> String {
        logs.iter()
            .map(|log| String::from_utf8_lossy(&log.content).to_string())
            .collect::<Vec<String>>()
            .join(separator)
    }
}