Closed davidkna closed 2 years ago
hmm. I don't think the TryFrom
thing is a very good API. The simpler, more obvious way to leverage the fact that some platforms provide both in one syscall would be to just have all the retrieval options as separate functions:
fn memory(&self) -> io::Result<Memory>
fn swap(&self) -> io::Result<Swap>
fn memory_and_swap(&self) -> io::Result<(Memory, Swap)> /// On some platforms this is more efficient than calling memory() and swap() separately
Done!
Thanks!
This PR adds
swap
toPlatform
and implements the required functionality for Linux, macOS and Windows. Further,TryFrom
is implemented betweenMemory
andSwap
based on per-platform compatibility (Linux and Windows are supported).Closes #93