Skip to content

内容出现重复,可能是写错误的 #16

@Rgoogle

Description

@Rgoogle

在第二章的内存部分

裸指针偏移计算相关方法
ptr::const T::offset(self, count:isize)-> const T 得到偏移后的裸指针
ptr::*const T::wrapping_offset(self, count: isize) -> *const T 考虑溢出绕回的offset
ptr::*const T::offset_from(self, origin: *const T) -> isize 计算两个裸指针的offset值
ptr::mut T::offset(self, count:isize)-> mut T 偏移后的裸指针
ptr::*const T::wrapping_offset(self, count: isize) -> *const T 考虑溢出绕回的offset
ptr::*const T::offset_from(self, origin: *const T) -> isize 计算两个裸指针的offset值
以上两个方法基本上通过intrinsic的函数实现

最后的两个函数和前面的重复了ptr::*const T::offset_from(self, origin: *const T) -> isize 比如这个就出现了两次。
还有在最新的rust版本里面有些函数已经不存在了。该仓库应该注明该文章有效的rust版本号

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions