GNU social JP
  • FAQ
  • Login
GNU social JPは日本のGNU socialサーバーです。
Usage/ToS/admin/test/Pleroma FE
  • Public

    • Public
    • Network
    • Groups
    • Featured
    • Popular
    • People

Conversation

Notices

  1. Embed this notice
    (unposting) (unspeaker@mastodon.social)'s status on Wednesday, 21-Aug-2024 22:34:28 JST (unposting) (unposting)

    anyone got a clue what's going on here?

    i know what the error message means, but i don't understand what causes `'static` lifetime to be required, considering I've explicitly specified the `'a`.

    there's this answer https://users.rust-lang.org/t/box-with-a-trait-object-requires-static-lifetime/35261/2 but it's from 2019 - did the language change?

    what am i overlooking?

    #rust #rustlang #lifetime #bug #ratatui

    In conversation Wednesday, 21-Aug-2024 22:34:28 JST from mastodon.social permalink

    Attachments


    1. https://files.mastodon.social/media_attachments/files/113/000/208/748/624/140/original/f9281c7527dce0a4.png
    2. Domain not in remote thumbnail source whitelist: global.discourse-cdn.com
      Box with a trait object requires static lifetime?
      You can write code blocks by enclosing them with triple backticks ```: ```rust struct Holder { ... ``` giving: struct Holder { objects: Vec, } impl Holder { fn add_object ( self: &'_ mut Self, object: T, ) { self.objects .push(Box::new(object)) ; } } Now, regarding the issue at hand, Box is just sugar for Box
    • Embed this notice
      esmevane, sorry (ironchamber@mastodon.esmevane.com)'s status on Wednesday, 21-Aug-2024 22:34:28 JST esmevane, sorry esmevane, sorry
      in reply to

      @unspeaker er. that is weird.

      disclaimer: i would fumble around on this, i'm not confident i know what is causing this

      does it have anything to do with deconstructing the box interior? since it's on the heap? is it possible you could pop something out of `Collection::Box` as a separate function or in a bracket expression so rustc knows that the box is out of scope when it goes for the interior value?

      In conversation Wednesday, 21-Aug-2024 22:34:28 JST permalink
    • Embed this notice
      (unposting) (unspeaker@mastodon.social)'s status on Wednesday, 21-Aug-2024 22:47:54 JST (unposting) (unposting)
      in reply to
      • esmevane, sorry

      @ironchamber

      hmm, i'm not sure i'm parsing your suggestion. is "pop something out" something that i should try doing, or is it a possibility that i need to account for?

      the goal is to compose `Render`able widgets inside the `render` method of other widgets

      Collected::Box is for when they are ephemeral (owned by the render method) and Collected::Ref is for when they are stateful (owned by the parent struct), if that makes sense

      In conversation Wednesday, 21-Aug-2024 22:47:54 JST permalink
    • Embed this notice
      esmevane, sorry (ironchamber@mastodon.esmevane.com)'s status on Wednesday, 21-Aug-2024 22:47:54 JST esmevane, sorry esmevane, sorry
      in reply to

      @unspeaker It totally makes sense! I think, but I'm not fully sure, that the Box interior to one of those variants might be introducing an opaque lifetime?

      what I'm suggesting is an `impl Collection` method that is apart from the trait, with fewer lifetimes to worry about, that gets the value inside the box somehow? Maybe that'll convince the compiler that ownership has changed.

      (A self invoking block might cause `Drop` to take things out of scope in the same way too)

      In conversation Wednesday, 21-Aug-2024 22:47:54 JST permalink
    • Embed this notice
      (unposting) (unspeaker@mastodon.social)'s status on Wednesday, 21-Aug-2024 22:48:54 JST (unposting) (unposting)
      in reply to
      • esmevane, sorry

      @ironchamber

      and this is based on some old code that used to work quite nicely for that purpose ... but i can't reuse it because reasons :(

      which is a damn shame because i liked it way better than #ratatui :(

      In conversation Wednesday, 21-Aug-2024 22:48:54 JST permalink
    • Embed this notice
      esmevane, sorry (ironchamber@mastodon.esmevane.com)'s status on Wednesday, 21-Aug-2024 22:48:54 JST esmevane, sorry esmevane, sorry
      in reply to

      @unspeaker haha I've been using ratatui a bit, it definitely is more of a tool kit than a framework, lots of boilerplate left on the table imo

      In conversation Wednesday, 21-Aug-2024 22:48:54 JST permalink
    • Embed this notice
      esmevane, sorry (ironchamber@mastodon.esmevane.com)'s status on Wednesday, 21-Aug-2024 23:03:49 JST esmevane, sorry esmevane, sorry
      in reply to

      @unspeaker you honestly can't trust the randosphere! i exercise a lot of caution too, any given day i'm not sure if it's too much or not enough lol

      In conversation Wednesday, 21-Aug-2024 23:03:49 JST permalink
    • Embed this notice
      (unposting) (unspeaker@mastodon.social)'s status on Wednesday, 21-Aug-2024 23:03:50 JST (unposting) (unposting)
      in reply to
      • esmevane, sorry

      @ironchamber

      yeah.. the only thing I like about ratatui really is the double buffering

      a couple years back i wrote my own framework on top of crossterm, was quite happy with how it let me compose things

      generic over backend too (business logic could theoretically be reused with a gui backend instead of tui)

      but i put it on github. and then something something trauma ostracism paranoia so now i can't reuse stuff that i've published on github because it's too connected with my past identity

      In conversation Wednesday, 21-Aug-2024 23:03:50 JST permalink
    • Embed this notice
      (unposting) (unspeaker@mastodon.social)'s status on Wednesday, 21-Aug-2024 23:03:50 JST (unposting) (unposting)
      in reply to
      • esmevane, sorry

      @ironchamber

      on one hand who's gonna doxx me over reusing my old code, and what's the chance they're gonna do anything to me - on the other even if the chance is minuscule the consequences would be beyond what i can deal with currently - so let's rewrite everything from scratch but worse 🤣

      In conversation Wednesday, 21-Aug-2024 23:03:50 JST permalink
    • Embed this notice
      esmevane, sorry (ironchamber@mastodon.esmevane.com)'s status on Thursday, 22-Aug-2024 00:18:44 JST esmevane, sorry esmevane, sorry
      in reply to

      @unspeaker I feel much the same way! I have so many private repos. My god. I've skimmed through your stuff a lot for reference though! I appreciate that you've shared it

      In conversation Thursday, 22-Aug-2024 00:18:44 JST permalink
    • Embed this notice
      (unposting) (unspeaker@mastodon.social)'s status on Thursday, 22-Aug-2024 00:18:45 JST (unposting) (unposting)
      in reply to
      • esmevane, sorry

      @ironchamber

      yeah... sucks innit... some days i think i've got legit reasons to be like that, some days i think it's just self-defeating behavior i should reject

      like if this project is just something to facilitate my own music making, i'd just develop in private and get it done sooner :(

      but i also want to use it to connect with people over a shared interest in programming and art, like having this conversation for example :)

      hell of a tradeoff, i want my work to have results already :x

      In conversation Thursday, 22-Aug-2024 00:18:45 JST permalink

Feeds

  • Activity Streams
  • RSS 2.0
  • Atom
  • Help
  • About
  • FAQ
  • TOS
  • Privacy
  • Source
  • Version
  • Contact

GNU social JP is a social network, courtesy of GNU social JP管理人. It runs on GNU social, version 2.0.2-dev, available under the GNU Affero General Public License.

Creative Commons Attribution 3.0 All GNU social JP content and data are available under the Creative Commons Attribution 3.0 license.