• Su Mingxian's avatar
    Add `MemoryAddr` trait, add `AddrRange` struct, use macro to generate... · b81b8219
    Su Mingxian authored
    Add `MemoryAddr` trait, add `AddrRange` struct, use macro to generate `PhysAddr` and `VirtAddr` (#1)
    
    * add `MemoryAddr` trait, use macro to generate `PhysAddr` and `VirtAddr`
    
    * loosen the bound of `MemoryAddr`, move functions about alignment back to `PhysAddr` and `VirtAddr`
    
    * update `def_addr_type!` to a better version, only `usize` supported now
    
    * fix formatter for address types generated by `def_addr_types!`
    
    * add `AddrRange`
    
    * export `AddrRange`
    
    * rename `def_addr_types!` to `def_usize_addr!`, and give it a new syntax
    
    * i love `///`
    
    * re-add mistakenly removed `as_ptr` and `as_mut_ptr` to `VirtAddr`
    
    * add doc comment to `VirtAddrRange` and `PhysAddrRange`
    
    * doc improvement
    
    * add a new `#[inline]`
    
    * move impl for `Debug`, `LowerHex`, and `UpperHex` from `def_usize_addr!` to a new macro named `def_usize_addr_formatter!`, which accepts custom formatter, in order to keep consistency with the original `Virt/PhysAddr::fmt`
    
    * doc fixed
    
    * update `Debug` impl for `AddrRange`, add `LowerHex` and `UpperHex` impl for `AddrRange`
    
    * a small doc fix about number of `#`s
    
    * a small doc fix
    
    * doc and fixes about `def_usize_addr!` and `def_usize_addr_formatter!`
    
    * change doctests for `AddrRange`
    
    * doc fix
    
    * replace `VirtAddrRange` with `AddrRange<usize>` in doc tests for `AddrRange`
    
    * hidden `fn main` in doc test of `def_usize_addr`
    
    * replace `VirtAddrRange` with `AddrRange<usize>` in doc tests for `AddrRange`
    b81b8219