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

分享一段代码

  •  
  •   helloworld2010 · 2020 年 9 月 15 日 · 2831 次点击
    这是一个创建于 1958 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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 年 9 月 15 日 via Android
    代码 timeout 了吗
    zephoony
        2
    zephoony  
       2020 年 12 月 4 日
    编译不过去
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   1083 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 19ms · UTC 17:56 · PVG 01:56 · LAX 09:56 · JFK 12:56
    ♥ Do have faith in what you're doing.