XU XUv0.16.0

#os/mmap

导入方式: #os/mmap

公开 API: 1 函数, 25 方法, 1 类型, 4 常量, 0 方法集

标准库包 `#os/mmap`。

const MADV_NORMAL

XuAPI
pub const MADV_NORMAL = 0

用途

常量 MADV_NORMAL,定义了相关的协议或算法配置参数。

const MADV_RANDOM

XuAPI
pub const MADV_RANDOM = 1

用途

常量 MADV_RANDOM,定义了相关的协议或算法配置参数。

const MADV_SEQUENTIAL

XuAPI
pub const MADV_SEQUENTIAL = 2

用途

常量 MADV_SEQUENTIAL,定义了相关的协议或算法配置参数。

const MADV_WILLNEED

XuAPI
pub const MADV_WILLNEED = 3

用途

常量 MADV_WILLNEED,定义了相关的协议或算法配置参数。

struct Mapping

XuAPI
pub struct Mapping {

}

用途

Mapping 上下文或状态结构体。

公开字段

此类型没有公开字段。

open

XuAPI
pub fn open(path string) Mapping

用途

打开资源或建立网络连接。失败时抛出错误,调用方需处理或继续传播。

参数

path string
文件系统路径(string)

返回值

Mapping — 该类型的值

(&Mapping) len

XuAPI
pub fn (m &Mapping) len() int

用途

&Mapping 上的操作:返回长度。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Mapping) is_empty

XuAPI
pub fn (m &Mapping) is_empty() bool

用途

&Mapping 上的操作:判断是否 empty。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Mapping) is_open

XuAPI
pub fn (m &Mapping) is_open() bool

用途

&Mapping 上的操作:判断是否 open。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

bool — 是否成立

(&Mapping) advise

XuAPI
pub fn (m &Mapping) advise(off int, n int, advice int) int

用途

在 &Mapping 上执行 advise 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
n int
数量、长度或上限(int)
advice int
advice(int)

返回值

int — 该类型的值

(&Mapping) advise_sequential

XuAPI
pub fn (m &Mapping) advise_sequential() int

用途

&Mapping 上的操作:执行 advise sequential 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Mapping) advise_random

XuAPI
pub fn (m &Mapping) advise_random() int

用途

&Mapping 上的操作:执行 advise random 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

int — 该类型的值

(&Mapping) advise_willneed

XuAPI
pub fn (m &Mapping) advise_willneed(off int, n int) int

用途

&Mapping 上的操作:执行 advise willneed 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

(&Mapping) byte_at

XuAPI
pub fn (m &Mapping) byte_at(off int) u8

用途

&Mapping 上的操作:执行 byte at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

u8 — 该类型的值

(&Mapping) u16_be

XuAPI
pub fn (m &Mapping) u16_be(off int) int

用途

&Mapping 上的操作:执行 u16 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) u24_be

XuAPI
pub fn (m &Mapping) u24_be(off int) int

用途

&Mapping 上的操作:执行 u24 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) u32_be

XuAPI
pub fn (m &Mapping) u32_be(off int) int

用途

&Mapping 上的操作:执行 u32 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) i32_be

XuAPI
pub fn (m &Mapping) i32_be(off int) int

用途

&Mapping 上的操作:执行 i32 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) u64_be

XuAPI
pub fn (m &Mapping) u64_be(off int) int

用途

&Mapping 上的操作:执行 u64 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) f32_be

XuAPI
pub fn (m &Mapping) f32_be(off int) f64

用途

&Mapping 上的操作:执行 f32 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

f64 — 该类型的值

(&Mapping) f64_be

XuAPI
pub fn (m &Mapping) f64_be(off int) f64

用途

&Mapping 上的操作:执行 f64 be 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

f64 — 该类型的值

(&Mapping) u16_le

XuAPI
pub fn (m &Mapping) u16_le(off int) int

用途

&Mapping 上的操作:执行 u16 le 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) u32_le

XuAPI
pub fn (m &Mapping) u32_le(off int) int

用途

&Mapping 上的操作:执行 u32 le 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) u64_le

XuAPI
pub fn (m &Mapping) u64_le(off int) int

用途

&Mapping 上的操作:执行 u64 le 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)

返回值

int — 该类型的值

(&Mapping) copy_to

XuAPI
pub fn (m &Mapping) copy_to(off int, dst $&[]u8, dst_off int, n int) int

用途

&Mapping 上的操作:拷贝到。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
dst $&[]u8
目标(独占借用,可修改原值;类型 $&[]u8)
dst_off int
dst_off(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

(&Mapping) read_bytes

XuAPI
pub fn (m &Mapping) read_bytes(off int, n int) []u8

用途

&Mapping 上的操作:读到 delim(含 delim)。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

[]u8 — 切片结果

(&Mapping) string_at

XuAPI
pub fn (m &Mapping) string_at(off int, n int) string

用途

&Mapping 上的操作:执行 string at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

string — 结果字符串

(&Mapping) write_to_file

XuAPI
pub fn (m &Mapping) write_to_file(dst &os.File, off int, n int) int

用途

&Mapping 上的操作:写入到文件。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
dst &os.File
目标(只读借用,调用方仍持有原值;类型 &os.File)
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

int — 该类型的值

(&Mapping) as_span

XuAPI
pub fn (m &Mapping) as_span() span.ByteSpan

用途

&Mapping 上的操作:执行 as span 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。

返回值

span.ByteSpan — 该类型的值

(&Mapping) span_at

XuAPI
pub fn (m &Mapping) span_at(off int, n int) span.ByteSpan

用途

&Mapping 上的操作:执行 span at 操作。失败时抛出错误,调用方需处理或继续传播。

参数

m &Mapping
本次调用使用的 Mapping 实例;以只读借用传入,调用方仍持有实例。
off int
偏移(int)
n int
数量、长度或上限(int)

返回值

span.ByteSpan — 该类型的值

($&Mapping) close

XuAPI
pub fn (m $&Mapping) close() int

用途

$&Mapping 上的操作:关闭资源。失败时抛出错误,调用方需处理或继续传播。

参数

m $&Mapping
本次调用使用的 Mapping 实例;以独占借用传入,方法可修改它,调用方仍持有实例。

返回值

int — 该类型的值