XU XUv0.16.0

#os/mmap

import: #os/mmap

counts: 1 functions, 25 methods, 1 types, 4 constants, 0 method sets

Cross-platform zero-copy read-only memory-mapped file owner. Non-Copy via its compiler-managed drop hook: closing or dropping a Mapping deterministically unmaps the address range. Empty files map to a valid zero-length view with a null base pointer.

const MADV_NORMAL

XuAPI
pub const MADV_NORMAL = 0

Purpose

Constant MADV_NORMAL, defining protocol or algorithm parameters.

const MADV_RANDOM

XuAPI
pub const MADV_RANDOM = 1

Purpose

Constant MADV_RANDOM, defining protocol or algorithm parameters.

const MADV_SEQUENTIAL

XuAPI
pub const MADV_SEQUENTIAL = 2

Purpose

Constant MADV_SEQUENTIAL, defining protocol or algorithm parameters.

const MADV_WILLNEED

XuAPI
pub const MADV_WILLNEED = 3

Purpose

Constant MADV_WILLNEED, defining protocol or algorithm parameters.

struct Mapping

XuAPI
pub struct Mapping {

}

Purpose

Mapping context or state structure.

Public fields

This type has no public fields.

open

XuAPI
pub fn open(path string) Mapping

Purpose

Open resource or establish connection. Throws on failure; handle the error or propagate it to the caller.

Parameters

path string
filesystem path (string)

Returns

Mapping — a value of this type

(&Mapping) len

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

Purpose

Operation on &Mapping: return the length.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

int — a value of this type

(&Mapping) is_empty

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

Purpose

Operation on &Mapping: whether it is empty.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

bool — true or false

(&Mapping) is_open

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

Purpose

Operation on &Mapping: whether it is open.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

bool — true or false

(&Mapping) advise

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

Purpose

Execute advise on &Mapping. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
n int
count, length, or limit (int)
advice int
advice (int)

Returns

int — a value of this type

(&Mapping) advise_sequential

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

Purpose

Operation on &Mapping: advise sequential. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

int — a value of this type

(&Mapping) advise_random

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

Purpose

Operation on &Mapping: advise random. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

int — a value of this type

(&Mapping) advise_willneed

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

Purpose

Operation on &Mapping: advise willneed. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

(&Mapping) byte_at

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

Purpose

Operation on &Mapping: byte at. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

u8 — a value of this type

(&Mapping) u16_be

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

Purpose

Operation on &Mapping: u16 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) u24_be

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

Purpose

Operation on &Mapping: u24 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) u32_be

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

Purpose

Operation on &Mapping: u32 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) i32_be

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

Purpose

Operation on &Mapping: i32 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) u64_be

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

Purpose

Operation on &Mapping: u64 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) f32_be

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

Purpose

Operation on &Mapping: f32 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

f64 — a value of this type

(&Mapping) f64_be

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

Purpose

Operation on &Mapping: f64 be. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

f64 — a value of this type

(&Mapping) u16_le

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

Purpose

Operation on &Mapping: u16 le. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) u32_le

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

Purpose

Operation on &Mapping: u32 le. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) u64_le

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

Purpose

Operation on &Mapping: u64 le. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&Mapping) copy_to

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

Purpose

Operation on &Mapping: copy to. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
dst $&[]u8
destination (exclusive borrow; may modify the original; type $&[]u8)
dst_off int
dst_off (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

(&Mapping) read_bytes

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

Purpose

Operation on &Mapping: read through delim (inclusive). Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
n int
count, length, or limit (int)

Returns

[]u8 — slice result

(&Mapping) string_at

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

Purpose

Operation on &Mapping: string at. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
n int
count, length, or limit (int)

Returns

string — result string

(&Mapping) write_to_file

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

Purpose

Zero-copy write of mapped range directly into an open destination file descriptor. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
dst &os.File
destination (read-only borrow; caller keeps the original; type &os.File)
off int
offset (int)
n int
count, length, or limit (int)

Returns

int — a value of this type

(&Mapping) as_span

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

Purpose

Operation on &Mapping: as span. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).

Returns

span.ByteSpan — a value of this type

(&Mapping) span_at

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

Purpose

Operation on &Mapping: span at. Throws on failure; handle the error or propagate it to the caller.

Parameters

m &Mapping
The Mapping instance used by this call (borrow).
off int
offset (int)
n int
count, length, or limit (int)

Returns

span.ByteSpan — a value of this type

($&Mapping) close

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

Purpose

Operation on $&Mapping: close the resource. Throws on failure; handle the error or propagate it to the caller.

Parameters

m $&Mapping
The Mapping instance used by this call (exclusive borrow).

Returns

int — a value of this type