cannot assign to self.cart.parent_order_sign, which is behind a & reference self is a & reference, so the data it refers to cannot be written.

    1. fn main() {
    2. let session = Session::new();
    3. let _ = get_effprod();
    4. }
    5. pub fn get_effprod(& self) -> bool {
    6. ...
    7. self.cart.product_list.push(...); // 报错
    8. ...
    9. }
    10. 正确的写法:&后面加上mut
    11. pub fn get_effprod(&mut self) -> bool {
    12. ...
    13. self.cart.product_list.push(...); // 报错
    14. ...
    15. }