我正在处理使用libcore
和no_std
的项目,这需要实现各种内存操作函数。但是,当我尝试实现memcpy时,
#[no_mangle]
#[no_stack_check]
pub unsafe extern fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8{
for i in 0..n {
*dest.offset(i as isize) = *src.offset(i as isize);
}
return dest;
}
我得到了
error: expected ident, found `*`
*dest.offset(i as isize) = *src.offset(i as isize);
^