I am not sure which connection URI I used to be honest. Sadly I cannot find a way to reproduce this issue. Again re-running the example code using qemu:///system seems to work just fine.
I think you might be more familiar with the design patterns of libvirt, so maybe you can answer me this question: couldn't it happen, that the the number of supported parameters for a given domain might again be zero?
Although I am currently not able to reproduce this error it nonetheless appeared, so maybe investigating this further could improve stability of this library.
Running the exmaple.rs example on my machine causes a panic in virt-0.3.1/src/domain.rs:1554
index out of bounds: the len is 0 but the index is 0.
The code never actually checks if sys::virDomainGetMemoryParameters sets nparams to a non-zero length, hence the params vector can have size 0 and indexing the first elem fails.
rust version: rustc 1.75.0 (82e1608df 2023-12-21) cargo version: cargo 1.75.0 (1d8b05cdd 2023-11-20) qemu version: 8.2.0
leongross (ca30d3cd) at 12 Oct 20:30
leongross (44b30285) at 12 Oct 14:25
fix minor README.md issues