x86_64 icon indicating copy to clipboard operation
x86_64 copied to clipboard

Impl `TryFrom`, `From`, and `Into` for `VirtAddr`

Open budde25 opened this issue 4 years ago • 1 comments

Hello,

I was wondering if it would be useful to Implement TryFrom, From, and Into for VirtAddr (and maybe other some types as well). I noticed that VirtAddr type specifically has a to_u64. Reading the docs though it seems like the Into trait might be a more idiomatic way to do this.

Another one that might make sense is the TryFrom for u64 and From trait for u32, u16, u8 (the latter would automatically create an Into according to the docs).

If this seems like a worthwhile feature I'd be happy to make pull request.

Fantastic crate btw!

budde25 avatar Jun 15 '21 23:06 budde25

@budde25 this seems reasonable. In https://github.com/rust-osdev/x86_64/issues/293#issuecomment-901804330 I brainstormed which conversion methods might make sense. PTAL

josephlr avatar Aug 19 '21 10:08 josephlr