V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
helloworld2010
V2EX  ›  Rust

分享一段代码

  •  
  •   helloworld2010 · 2020-09-15 19:21:13 +08:00 · 2342 次点击
    这是一个创建于 1290 天前的主题,其中的信息可能已经有所发展或是发生改变。
    fn main() {
        let mut a = Some(1);
    
        if let &mut Some(x) = &mut a {
            println!("{:?}", x);
        }
    
        if let Some(y) = &mut a {
            *y = 2;
            println!("{:?}", y);
        }
    
        if let z = &mut a {
            *z = Some(3);
            println!("{:?}", z);
        }
    }
    
    2 条回复    2020-12-04 09:32:27 +08:00
    ila
        1
    ila  
       2020-09-15 20:31:15 +08:00 via Android
    代码 timeout 了吗
    zephoony
        2
    zephoony  
       2020-12-04 09:32:27 +08:00
    编译不过去
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1269 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 17:51 · PVG 01:51 · LAX 10:51 · JFK 13:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.