43,911 questions
-2
votes
0
answers
27
views
UDP broadcast discovery works Linux → Windows but not Windows → Linux [closed]
I’m implementing LAN peer discovery in Rust using UDP broadcast with Tokio.
Environment
Windows + Fedora Linux
Same Wi-Fi network, no VPN
UDP port 7777
Problem
✅ Linux can discover Windows
❌ ...
0
votes
0
answers
41
views
TcpStream 'misses' packets if it is not polled frequently enough
I have been facing an issue in Rust with processing TCP packets from a system in Bevy (a game engine based on an entity component system).
The TCP packets in a TcpStream (but NOT in a TcpListener) ...
0
votes
1
answer
55
views
Implement supertrait using subtrait
In the Rust Reference, there is an example of supertraits:
trait Shape { fn area(&self) -> f64; }
trait Circle where Self: Shape {
fn radius(&self) -> f64 {
// A = pi * r^2
...
2
votes
1
answer
55
views
"field must implement `Copy`" in union on field with derived Copy
Erring code in question:
#[derive(Debug, Clone, Copy)]
struct OfflineWord {
word: u64,
flag: u64,
}
#[derive(Debug, Clone, Copy)]
struct OnlineWord<'file, F: AsRef<Path>> {
...
2
votes
2
answers
82
views
Rust and C++ FFI: orchestrating destructors/drops of struct fields
Because of some FFI code interacting with C++ I need precise manual control on when the Drop::drop() method of types is called w.r.t. those of fields.
To be more precise:
When a C++ struct is ...
0
votes
0
answers
21
views
DMX and embassy_stm32
I'm having trouble getting the dmx reception to work; I'm unable to properly align my reads to the dmx break condition.
In Usart terms: I want to wait for a Framing error and then read the next 513 ...
1
vote
0
answers
44
views
Allow mutable borrow alongside immutable borrow in Rust [duplicate]
The Rust compiler doesn't allow the following code to compile. This is because the for loop which calls thing.get_prefixes() creates an immutable reference to thing, and during the loop body the ...
Advice
0
votes
1
replies
62
views
Cross-platform clipboard sync in Rust – polling vs OS events
I’m new here and working on a personal Rust project: a local Wi-Fi clipboard sync tool for Windows (GNU based linker), Linux, and FreeBSD.
The idea is simple: detect clipboard changes on one machine ...
3
votes
0
answers
92
views
Unique combinations preserving order
I have a list of elements like [1, 1, 2, 2, 3, 4, 5]. I want to iterate through all the k-length sub-lists of this list, such that identical combinations do not occur, that is I don't get [1, 3, 4] ...
Advice
1
vote
8
replies
114
views
Rust slice operator overloading
I have a slice(start, end) method and I tried to find if I can wrap that in an overloaded slice or range operator:
//instead of ...
let piece = pie.slice(start, end);
//have ...
let piece = pie[start.....
0
votes
0
answers
70
views
`btvirt` (virtualized BlueTooth) with TrouBLE [closed]
Desired behavior
Have the central make a connection with the peripheral.
The "trouBLE" I run in to
The central code returns directly a BleHost(Timeout) error, even with adjusted settings
I'...
1
vote
1
answer
40
views
Generate XML from Rust generated from XSD file containing xs:choice elements
I'm trying to convert a SEPA XSD file (namely pain.008.001.11 from https://www.iso20022.org/iso-20022-message-definitions) to Rust structs which works great so far. Since I want to generate XML files ...
3
votes
1
answer
70
views
Conflict on generic TryFrom impl but not on generic From impl
I'm trying to implement TryFrom over a type parameter, like so:
enum MyType {}
struct MyError();
impl<T: Into<u8>> TryFrom<T> for MyType {
type Error = MyError;
fn try_from(...
0
votes
0
answers
127
views
What exactly is a context of an expression?
Up until now, I thought of a context as a place in the code that expects a certain kind of expression. The Rust Reference on Expressions writes for example that:
The following contexts are place ...
-2
votes
0
answers
106
views
How to make Windows file processing go at a bearable speed? [closed]
I am building a music player and I need to load in a music library, so naturally I need to process a large quantity of files quickly. I only need a small portion from the beginning of each music file, ...