zoukankan      html  css  js  c++  java
  • rust 建造者模式

    
    #[derive(Debug,Serialize,Deserialize,Default)]
    pub struct TableInfo{
        sheet_name:String,
        table_token:String,
        sheet_title:String,
    }
    
    
    impl TableInfo {
        #[warn(non_snake_case)]
        #[allow(dead_code)]
        pub fn new() -> Self{
            TableInfo{
                ..Default::default()
            }
        } 
    
        #[allow(dead_code)]
        pub fn set_name(mut self, sheet_name:&str) -> Self{
            self.sheet_name = sheet_name.to_string();
            self
        }
    
        #[warn(non_snake_case)]
        #[allow(dead_code)]
        pub fn set_table_token(mut self, table_token:&str) -> Self{
            self.table_token = table_token.to_string();
            self
        }
    
        #[warn(non_snake_case)]
        #[allow(dead_code)]
        pub fn sheet_title(mut self, sheet_title:&str) -> Self{
            self.sheet_title = sheet_title.to_string();
            self
        }
    
        #[allow(dead_code)]
        pub fn build(self) -> Self{
            self
        }
    }
    
    
  • 相关阅读:
    安卓第三次作业
    安卓第二次作业
    十三周作业
    2020年5月28日
    十二周上机练习
    十一周作业
    2020年5月14日
    2020年5月7日上机练习
    第九周练习
    Online Tristesse
  • 原文地址:https://www.cnblogs.com/Alpacapyer/p/14693226.html
Copyright © 2011-2022 走看看