726
26

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

727
11

I have a fun one, where the compiler says I have an unused lifetime parameter, except it's clearly used. It feels almost like a compiler error, though I'm probably overlooking something? Who can see the mistake?

main.rs

trait Context<'a> {
    fn name(&'a self) -> &'a str;
}

type Func<'a, C: Context<'a>> = dyn Fn(C);

pub struct BuiltInFunction<'a, C: Context<'a>> {
    pub(crate) func: Box<Func<'a, C>>,
}
error[E0392]: parameter `'a` is never used
 --> src/main.rs:7:28
  |
7 | pub struct BuiltInFunction<'a, C: Context<'a>> {
  |                            ^^ unused parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

For more information about this error, try `rustc --explain E0392`.
error: could not compile `lifetime-test` (bin "lifetime-test") due to 1 previous error
728
19
729
17

The focus of this release is the high-level API, which abstracts rendering together with physics (via Rapier3D). See the new “vehicle” example code for the reference.

vehicle example

In addition, blade-graphics-0.4 contains improved presentation API with control for color spaces and display synchronization, more texture formats, and an important platform bug workaround.

730
50
2024 Edition Update (blog.rust-lang.org)
731
37
732
79
submitted 2 years ago* (last edited 2 years ago) by jwr1@kbin.earth to c/rust@programming.dev

Empowering everyone to build reliable and efficient software.

733
25

Hey all,

I'm going to be moving on to my next project and have been thinking about doing an email client. I like Thunderbird, but the search is terrible, and I also want to tackle something that needs pretty high performance for processing emails etc.

Any suggestions or considerations I should think about?

I'll focus on just getting SMTP going in a CLI then I'll introduce some sort of frontend using Qt.

734
37

Always good to read about how you can speed up compile times. I mean, sword fighting on office chairs are all fun, but still....

735
11
Cargo env file? (lemmy.physfluids.fr)

Hello,

I have a project for which some machines have only a subset of features set. Currently, I write

cargo run --no-default-features --features "toto,titi" --bin my_bin

This is a bit cumbersome and I sometimes forget the --no-default-features --features part. I was wondering if there is a local config file that I could put in the directory to instruct cargo to use this particular subset of features. I guess this should be in the documentation, but I didn't find it.

736
40
submitted 2 years ago* (last edited 2 years ago) by snaggen@programming.dev to c/rust@programming.dev

The Sovereign Tech Fund announced, in their latest news letter, that they are investing €99,060.00 in uutils coreutils which is a Rust rewrite of GNU coreutils. And here is a link to github https://github.com/uutils/coreutils

737
29

It is time for pre-release testing....

738
9

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

739
22
740
25
Zig, Rust and other languages (notes.eatonphil.com)

What do you think about the points the authors makes?

741
15

Kellnr 5.2.0 is released. Besides many small changes, the main feature of this release is UI support for cached crates. Until now, only private crates were shown in the UI. Now, cached crates from crates.io are shown and searchable from the UI, too.

742
23
743
20
744
21
Link against external DLL (lemmy.physfluids.fr)

Hello,

I am trying to use the SDK provided by the manufacturer of a camera from Rust. I use this in the build.rs :

println!(r"cargo:rustc-link-search=C:\Program Files\Digital Camera Toolbox\Camware4");
println!("cargo:rustc-link-lib=SC2_Cam");

However, it tries to find a .lib file, while the actual file is SC2_Cam.dll. I’ve tried specifying the kind as dylib=SC2_Cam but it makes no difference.

Am I missing something obvious, or is it just not possible? Do I have to manually load the DLL at runtime with things like the libloading crate?

745
10
submitted 2 years ago* (last edited 2 years ago) by erlend_sh@lemmy.world to c/rust@programming.dev

This article shows the overview of the development process of the Fish Folly game using Fyrox Game Engine.

746
38

A saw this on Mastodon, and found it interesting. Rust already prevents a lot of race conditions, but deadlocks when using a mutex is still possible (and I have actually had one myself, though I caught it during testing). So, it would be nice if it would be possible to catch these cases at compile time. Now, seems to be just a proof of concept, but it is always nice to see the direction people are going and what areas are explored.

747
10
submitted 2 years ago by veer66@lemmy.one to c/rust@programming.dev

Removing last will break my library.

#[macro_export]
macro_rules! list {
    () => {
	None
    };
    [ $x:expr, $( $y:expr ),* ] => {
	{
	    let mut first = cons($x, &None);
	    let mut last = &mut first;
	    $(
		let yet_another = cons($y, &None);
		if let Some(ref mut last_inner) = last {
		    let last_mut = Rc::get_mut(last_inner).unwrap();
		    last_mut.cdr = yet_another;
		    last = &mut last_mut.cdr;
		}
	    )*
	    first
	}
    }
}

This macro works as I expected because it can pass these tests.

    #[test]
    fn dolist() {
        let mut v = vec![];
        dolist!((i &cons(10, &list![20, 30, 40])) {
            v.push(i.car);
        });
        assert_eq!(v, vec![10, 20, 30, 40]);
    }

    #[test]
    fn turn_list_to_vec() {
        assert_eq!(list_to_vec(&list![1, 2, 3]), vec![1, 2, 3]);
    }

    #[test]
    fn count_elements() {
        assert_eq!(list_len(&list![10, 20, 30]), 3);
    }

However I got the warning "value assigned to last is never read."

How can I avoid this warning?

P.S. Full code

748
11
Rust Analyzer Changelog #224 (rust-analyzer.github.io)
749
82
750
27

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

view more: ‹ prev next ›

Rust

8252 readers
30 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS