helloworld2010
V2EX  ›  Rust

分享一段代码

  •  
  •   helloworld2010 · Sep 15, 2020 · 3008 views
    This topic created in 2071 days ago, the information mentioned may be changed or developed.
    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 replies    2020-12-04 09:32:27 +08:00
    ila
        1
    ila  
       Sep 15, 2020 via Android
    代码 timeout 了吗
    zephoony
        2
    zephoony  
       Dec 4, 2020
    编译不过去
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5340 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 08:15 · PVG 16:15 · LAX 01:15 · JFK 04:15
    ♥ Do have faith in what you're doing.