Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

  • voklen@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    7 months ago

    This week I’m working on the backend for a little platform that I’m making for debating. Where each side can make points and reply to others people’s points, then after a point has been argued out to the bottom it either goes green to show it still stands or grey to show there’s a good counter-argument. The frontend is made with SolidJS and I’m really having fun making it so far.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    7 months ago

    Still working on my P2P Lemmy/Reddit alternative. I made the UI prettier and got CI all figured out. It’s written with Iroh and Tauri, with React on the FE.

    So this week will be filling in the basic features (voting, commenting, etc). And maybe a little bit of testing NAT traversal and whatnot.

    If I get super productive, I can start playing around with decentralized moderation. That’s the most interesting part of the app, and I have some POC code for it, just need to add in the data and start tuning (will probably scrape some Lemmy data 🙃). Once that’s there, I’ll be ready to share my project publicly for the first time (😧).

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        arrow-up
        1
        ·
        7 months ago

        Certainly!

        I still need to think about what I want in terms of licensing (it’s currently MPL 2.0), but once I figure that out, I’d love some help. Also, naming things is hard. 🙃

        • taladar@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          7 months ago

          For the name maybe you could do some sort of play on the expression “spread the word” since it is distributed? Probably not something you want to use verbatim though since it would be hard to search.

          • sugar_in_your_tea@sh.itjust.works
            link
            fedilink
            arrow-up
            1
            ·
            7 months ago

            Yeah, I’ve been looking at variations of “handbill.” I have a name with a decent domain and everything, but it’s hard to pronounce by E. Asians and taken by another popular project.

            But I have a fallback plan, so I’m gonna go with it unless I think of something better.

  • PlexSheep@infosec.pub
    link
    fedilink
    arrow-up
    5
    ·
    7 months ago

    I’m still working on a benchmark for my wordle solver. The thing itself works, but I want it to print statuses while benching.

    I cannot do it. I’ve spent hours on this, even tried to make the bench async and run it in a separate Tokio task. I cannot share my bench strict over a thread, and cloning is impossible too, because of something.

    Sometimes, the lifetime and ownership stuff of rust really gets annoying. C would’ve just done the stuff and be done with it. (Maybe)

      • PlexSheep@infosec.pub
        link
        fedilink
        arrow-up
        5
        ·
        7 months ago

        The whole code is here

        (It does not compile right now)

        I understand why it does not work, but I don’t know how to achieve what I’m looking for.

        This is the code snippet from the binary:

            let wl = BuiltinWList::default();
            let builder: GameBuilder<'_, BuiltinWList> = game::Game::builder(&wl)
                .length(cli.length)
                .max_steps(cli.max_steps)
                .precompute(cli.precompute);
            let solver: AnyBuiltinSolver<'_, BuiltinWList> = cli.solver.to_solver(&wl);
            let bench = BuiltinBenchmark::build(&wl, solver, builder, cli.threads)?;
            trace!("{bench:#?}");
        
            bench.start()?;
        
            loop {
                sleep_ms(1000);
                println!("{}", bench.report());
                if bench.is_finished() {
                    break;
                }
            }
        
            Ok(())
        }
        

        From the CI

        error[E0521]: borrowed data escapes outside of method
          --> src/bench/builtin.rs:79:18
           |
        23 |   impl<'wl, WL, SL> Benchmark<'wl, WL, SL> for BuiltinBenchmark<'wl, WL, SL>
           |        --- lifetime `'wl` defined here
        ...
        75 |       fn start(&'wl self, n: usize) -> WResult<()> {
           |                --------- `self` is a reference that is only valid in the method body
        ...
        79 |           let th = std::thread::spawn(move||{
           |  __________________^
        80 | |             Self::bench(n, report, solver, builder)
        81 | |         });
           | |          ^
           | |          |
           | |__________`self` escapes the method body here
           |            argument requires that `'wl` must outlive `'static`
        error[E0597]: `builder` does not live long enough
          --> src/bench/mod.rs:54:32
           |
        21 | pub trait Benchmark<'wl, WL, SL>: Sized + Debug + Sync
           |                     --- lifetime `'wl` defined here
        ...
        51 |             .for_each_with(report.clone(), |outside_data, _i| {
           |                                            ------------------ value captured here
        ...
        54 |                     .play(&mut builder.build().expect("could not create game"))
           |                                ^^^^^^^----------------------------------------
           |                                |
           |                                borrowed value does not live long enough
           |                                argument requires that `builder` is borrowed for `'wl`
        ...
        62 |     }
           |      - `builder` dropped here while still borrowed
        
    • sugar_in_your_tea@sh.itjust.works
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      7 months ago

      Cool! It would be cool to get read-only access at least for ext4 for macOS and Windows.

      Since it’s no_std, are you planning to use this in an embedded project or something?

      • Rat Cornu@ani.social
        link
        fedilink
        arrow-up
        2
        ·
        7 months ago

        Thanks! Actually, I decided to make this library during a OS course in which I made a microkernel (non usable but you can found it here). So currently the project is only to make this library, and I hope other projects will begin to use it if it becomes enough stable ^^

        • sugar_in_your_tea@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          7 months ago

          Have you looked at Redox OS? It’s a microkernel-based OS written in Rust, and I’m guessing they could use something like this. I don’t know what support they already have, but surely they don’t have every basic filesystem implemented.

          That said, the GPL v3 may be problematic, depending on the project. Still cool regardless though.

          • Rat Cornu@ani.social
            link
            fedilink
            arrow-up
            2
            ·
            7 months ago

            Thanks! Yes I look into RedoxOS and I would like to take a look deeper in it to see if the FS could be interesting to implement