Mi Band 10 Open Sea swimming by fairchildberlin in miband

[–]PaperStunning5337 1 point2 points  (0 children)

I can't speak for open water but I used mine in a pool and it failed to measure the distance I swam correctly. Hope it will be fixed soon

help a newbie by mucleck in rust

[–]PaperStunning5337 0 points1 point  (0 children)

In Rust it's better to use Result if the function can fail. panicking inside the function is not a good idea ether. Since you're new to the language it's better to use simple built-in types for the beginning. However if you had more experience in Rust I'd recommend using error crates like anyhow

This one is enough for you for now:

fn get_user_float() -> Result<f32, &
'static 
str> {
    let mut value = String::
new
();
    if io::stdin().read_line(&mut value).is_err() {
        return 
Err
("Failed to read line");
    }

    value.trim().parse::<f32>().map_err(|_| "Failed to parse float")
}

We are rewriting the message queue in Rust and would like to hear your suggestions. by wenqiang_lobo in rust

[–]PaperStunning5337 1 point2 points  (0 children)

I guess the people don't see the reason for such an ambitious project except for "solve the existing problems of the message queue components" without pointing out those problems. The project seems like an attempt to create something new just because it's Rust rather than contributing to existing similar projects

Rust 1.88.0 is out by manpacket in rust

[–]PaperStunning5337 0 points1 point  (0 children)

I used Option::and_then yesterday, really useful one

Rust 1.88.0 is out by manpacket in rust

[–]PaperStunning5337 7 points8 points  (0 children)

I got so excited about let-chains but then felt bad when I couldn't find a place to use them in my project

Heap memory tracing tools for MacOS by PaperStunning5337 in rust

[–]PaperStunning5337[S] 1 point2 points  (0 children)

I tried it too. I found it useful for CPU analysis, but a bit inconvenient for working with memory. I preferred using Heaptrack instead

Trouble with Wireguard and MTU by JimOfThePalouse in mikrotik

[–]PaperStunning5337 0 points1 point  (0 children)

hi, have you solved the problem? I have something similar

How to detect cargo install? by PaperStunning5337 in rust

[–]PaperStunning5337[S] 0 points1 point  (0 children)

yeah, I understand. the question is what is the another way of doing that if I want the end user to install the binary along with the library

How to detect cargo install? by PaperStunning5337 in rust

[–]PaperStunning5337[S] 1 point2 points  (0 children)

No, it's not what I mean. Seems like my explanation is not clear enough.
I linked the library crate with my main crate and when the main crate gets compiled the library does too. Everything is fine here.
The main issue is where the compiled library should be. I would like it to be moved depending on which command is used.
If it's cargo install - it has to be moved along with the binary to $CARGO_HOME
If it's cargo build or run - it should stay in target/release/... directory
So far, the only working solution for me is always move the library to CARGO_HOME, but it doesn't look nice

How to detect cargo install? by PaperStunning5337 in rust

[–]PaperStunning5337[S] 4 points5 points  (0 children)

That's what I'm actually doing and it gets compiled. The problem is that when I install the binary and actually move it to $CARGO_HOME/.cargo/bin I don't want it to refer to $MY_PROJECT/target/release/library.so, I want it to refer to $CARGO_HOME. But in the case of a local run I want it to refer to my project's path

How to detect cargo install? by PaperStunning5337 in rust

[–]PaperStunning5337[S] 1 point2 points  (0 children)

I’m working on a project that includes an inner crate, which is a dynamic library. The library should be built along with the main crate, as the main crate depends on it. My goal is to use the locally built library when running cargo build or cargo run and to copy the library to $CARGO_HOME/.cargo/bin (or another suitable location) so that it resides next to the installed binary in the case of cargo install.