Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我有一个[*]u8指针和一个usize长度时,如何将指针转换为[]u8具有指定长度的切片?
[*]u8
usize
[]u8
[*]u8在指针上使用切片语法:
fn to_slice(pointer: [*]u8, len: usize) []u8 { return pointer[0..len]; }