Search

Items tagged with: Rust


That's how much handwritten written code is needed to call a new core function from desktop, before and after jsonrpc. Many thanks to #rust proc macros for making this possible.
#rust


#rust #web


#rust





#rust


#rust


#rust


I'm experimenting with the #libreoffice SDK to write a small #nextcloud app. I'm using the #cpp API because I want to wrap it in an #Rust #HTTP backend.

It is hard to figure out how to use the API and questions on Stackoverflow are hard to align with the #libreoffice examples. For example, stackoverflow.com/q/62769483 does not really help. I guess you need to be familiar with the API before you will understand it.

@libreoffice, do you have any pointers to become more comfortable with the API?


#Rust help requested. I am officially at wits end here.

Please take a look at my source file sdlstate.rs.

I'm getting a borrow checker error E0597 on line 39, indicating that tc does not live long enough. However, looking at the sdl2 sources (via its rust-docs), I don't see how my created texture, t, can possibly still refer to tc, which as far as I'm aware, is the only way this error can be generated under current conditions.

error[E0597]: `tc` does not live long enough<br>  --> src/sdlstate.rs:39:21<br>   |<br>14 |   impl<'a> SdlState<'a> {<br>   |        -- lifetime `'a` defined here<br>...<br>39 |           let mut t = tc<br>   |  _____________________^<br>40 | |             .create_texture(<br>41 | |                 Some(sdl2::pixels::PixelFormatEnum::RGBA8888),<br>42 | |                 sdl2::render::TextureAccess::Streaming,<br>43 | |                 self.width,<br>44 | |                 self.height,<br>45 | |             )<br>   | |_____________^ borrowed value does not live long enough<br>...<br>49 |           self.current_texture.set(Some(t));<br>   |           --------------------------------- argument requires that `tc` is borrowed for `'a`<br>...<br>56 |       }<br>   |       - `tc` dropped here while still borrowed<br><br>

Why is this happening? Why can't I re-arrange the code to prevent this from happening?

Right now, the only way this code will compile and run correctly is if I manually inject the re-paint code where I invoke f(), which utterly defeats the purpose and benefit of using closures in the first place.

In an attempt to fix this, I've tried:

  • Replacing the Cell with RefCell.
  • Removing Cell all-together and just using a raw Option type.
  • Removing the 'a lifetime annotation.

None of these work, and almost always introduce some manner of errors on their own.

Please help. Thanks.

#rust


Today I wrote my first GNOME app with rust. It's called switch and I can toggle a 💡 with it 😃

Special thanks to @ebassi for his ongoing series of video streams, which make it much easier for me to get into GNOME and rust programming.

#gnome #gtk #rust


Now that I'm on a new instance, I'll write a new #introduction.

I am a follower of Jesus, mutualist hobbyist programmer, and sysadmin (in that order). I'm passionate about #CooperativeTechnology, #smalltech, and liberating people all around within and without technology.

I'm interested in alternative internet protocols (#Gemini), mobile Linux, real sustainability, and various computer languages (including #Rust and #Zig).

Also hosting benign.town! Join us if you'd like. 🙂




Heads up: phosh-osk-stub moved out of #phosh's repo and to: gitlab.gnome.org/guidog/phosh-… as it acquired more and more cruft while debugging some (now fixed) touch input related issues in #gtk 4.

Mostly mentioning it here since some distros (such as #debian) used it in the past on architectures that had trouble building #rust to fulfill session dependencies (which is not an issue anymore nowadays) so it can safely be dropped.