Seems like an interesting effort. A developer is building an alternative Java-based backend to Lemmy’s Rust-based one, with the goal of building in a handful of different features. The dev is looking at using this compatibility to migrate their instance over to the new platform, while allowing the community to use their apps of choice.

  • @[email protected]
    link
    fedilink
    English
    1
    edit-2
    10 months ago

    Here’s some examples written on my phone:

    match result {
        Ok(bool_name) => whatever,
        Err(error_type) => whatever,
    }
    
    if let Ok(bool_name) = result {
        whatever
    }
    
    if result.is_ok() {
        whatever
    }
    
    let whatever = result.unwrap_or_default();
    let whatever = result?;
    

    And there’s many other awesome ways to use a Result including turning it into an Option or unwrapping it unsafely. I recommend you just search “Rust book” on your search engine and browse it. Here’s the docs to the Result enum.

    • @uranibaba
      link
      English
      110 months ago

      Ah, so it is like a wrapper enum, ok contains the data type you want and err the error object?

      • @[email protected]
        link
        fedilink
        English
        110 months ago

        Exactly! The other wrapper enum I named (Option) is the same kind of concept but with Some(value) and None.