XU XUv0.16.0

#bytes/span

导入方式: #bytes/span

公开 API: 11 函数, 40 方法, 8 类型, 0 常量, 0 方法集

标准库包 `#bytes/span`。

struct ByteSpan

XuAPI
pub struct ByteSpan {

}

用途

ByteSpan 上下文或状态结构体。

公开字段

此类型没有公开字段。

struct MutByteSpan

XuAPI
pub struct MutByteSpan {

}

用途

MutByteSpan 上下文或状态结构体。

公开字段

此类型没有公开字段。

struct F32Span

XuAPI
pub struct F32Span {

}

用途

F32Span 上下文或状态结构体。

公开字段

此类型没有公开字段。

struct MutF32Span

XuAPI
pub struct MutF32Span {

}

用途

MutF32Span 上下文或状态结构体。

公开字段

此类型没有公开字段。

struct ByteSpanPair

XuAPI
pub struct ByteSpanPair {
    pub left ByteSpan
    pub right ByteSpan
}

用途

承载 left、right 等属性的结构体。

公开字段

left ByteSpan
字段(ByteSpan)
right ByteSpan
字段(ByteSpan)

struct MutByteSpanPair

XuAPI
pub struct MutByteSpanPair {
    pub left MutByteSpan
    pub right MutByteSpan
}

用途

承载 left、right 等属性的结构体。

公开字段

left MutByteSpan
字段(MutByteSpan)
right MutByteSpan
字段(MutByteSpan)

struct PlaneView

XuAPI
pub struct PlaneView {
    pub ptr c_ptr
    pub width int
    pub height int
    pub stride int
    pub bpp int
}

用途

承载 ptr、width、height、stride、bpp 等属性的结构体。

公开字段

ptr c_ptr
字段(c_ptr)
width int
字段(int)
height int
字段(int)
stride int
字段(int)
bpp int
字段(int)

struct MutPlaneView

XuAPI
pub struct MutPlaneView {
    pub ptr c_ptr
    pub width int
    pub height int
    pub stride int
    pub bpp int
}

用途

承载 ptr、width、height、stride、bpp 等属性的结构体。

公开字段

ptr c_ptr
字段(c_ptr)
width int
字段(int)
height int
字段(int)
stride int
字段(int)
bpp int
字段(int)

empty_bytes

XuAPI
pub fn empty_bytes() ByteSpan

用途

执行 empty bytes 操作。

参数

无需传入参数。

返回值

ByteSpan — 该类型的值

empty_mut_bytes

XuAPI
pub fn empty_mut_bytes() MutByteSpan

用途

执行 empty mut bytes 操作。

参数

无需传入参数。

返回值

MutByteSpan — 该类型的值

empty_f32

XuAPI
pub fn empty_f32() F32Span

用途

执行 empty f32 操作。

参数

无需传入参数。

返回值

F32Span — 该类型的值

empty_mut_f32

XuAPI
pub fn empty_mut_f32() MutF32Span

用途

执行 empty mut f32 操作。

参数

无需传入参数。

返回值

MutF32Span — 该类型的值

from_bytes

XuAPI
pub fn from_bytes(b &[]u8) ByteSpan

用途

从 bytes 构造。

参数

b &[]u8
要处理的切片(只读借用,调用方仍持有原值;类型 &[]u8)

返回值

ByteSpan — 该类型的值

from_bytes_mut

XuAPI
pub fn from_bytes_mut(b $&[]u8) MutByteSpan

用途

从 bytes mut 构造。

参数

b $&[]u8
要处理的切片(独占借用,可修改原值;类型 $&[]u8)

返回值

MutByteSpan — 该类型的值

from_string

XuAPI
pub fn from_string(s &string) ByteSpan

用途

从 string 构造。

参数

s &string
源字符串(只读借用,调用方仍持有原值;类型 &string)

返回值

ByteSpan — 该类型的值

from_f32

XuAPI
pub fn from_f32(f &[]f32) F32Span

用途

从 f32 构造。

参数

f &[]f32
回调或格式串(只读借用,调用方仍持有原值;类型 &[]f32)

返回值

F32Span — 该类型的值

from_f32_mut

XuAPI
pub fn from_f32_mut(f $&[]f32) MutF32Span

用途

从 f32 mut 构造。

参数

f $&[]f32
回调或格式串(独占借用,可修改原值;类型 $&[]f32)

返回值

MutF32Span — 该类型的值

(&ByteSpan) len

XuAPI
pub fn (s &ByteSpan) len() int

用途

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

参数

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

返回值

int — 该类型的值

(&ByteSpan) is_empty

XuAPI
pub fn (s &ByteSpan) is_empty() bool

用途

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

参数

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

返回值

bool — 是否成立

(&ByteSpan) sub

XuAPI
pub fn (s &ByteSpan) sub(lo int, hi int) ByteSpan

用途

&ByteSpan 上的操作:相减。失败时抛出错误,调用方需处理或继续传播。

参数

s &ByteSpan
本次调用使用的 ByteSpan 实例;以只读借用传入,调用方仍持有实例。
lo int
lo(int)
hi int
hi(int)

返回值

ByteSpan — 该类型的值

(&ByteSpan) split_at

XuAPI
pub fn (s &ByteSpan) split_at(mid int) ByteSpanPair

用途

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

参数

s &ByteSpan
本次调用使用的 ByteSpan 实例;以只读借用传入,调用方仍持有实例。
mid int
mid(int)

返回值

ByteSpanPair — 该类型的值

(&ByteSpan) u8_at

XuAPI
pub fn (s &ByteSpan) u8_at(i int) u8

用途

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

参数

s &ByteSpan
本次调用使用的 ByteSpan 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)

返回值

u8 — 该类型的值

(&ByteSpan) u16_be

XuAPI
pub fn (s &ByteSpan) u16_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&ByteSpan) u32_be

XuAPI
pub fn (s &ByteSpan) u32_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&ByteSpan) u64_be

XuAPI
pub fn (s &ByteSpan) u64_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&ByteSpan) u32_le

XuAPI
pub fn (s &ByteSpan) u32_le(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&ByteSpan) to_bytes

XuAPI
pub fn (s &ByteSpan) to_bytes() []u8

用途

&ByteSpan 上的操作:转换为 bytes。

参数

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

返回值

[]u8 — 切片结果

(&MutByteSpan) len

XuAPI
pub fn (s &MutByteSpan) len() int

用途

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

参数

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

返回值

int — 该类型的值

(&MutByteSpan) is_empty

XuAPI
pub fn (s &MutByteSpan) is_empty() bool

用途

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

参数

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

返回值

bool — 是否成立

(&MutByteSpan) as_span

XuAPI
pub fn (s &MutByteSpan) as_span() ByteSpan

用途

&MutByteSpan 上的操作:执行 as span 操作。

参数

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

返回值

ByteSpan — 该类型的值

(&MutByteSpan) sub

XuAPI
pub fn (s &MutByteSpan) sub(lo int, hi int) MutByteSpan

用途

&MutByteSpan 上的操作:相减。失败时抛出错误,调用方需处理或继续传播。

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
lo int
lo(int)
hi int
hi(int)

返回值

MutByteSpan — 该类型的值

(&MutByteSpan) split_at_mut

XuAPI
pub fn (s &MutByteSpan) split_at_mut(mid int) MutByteSpanPair

用途

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

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
mid int
mid(int)

返回值

MutByteSpanPair — 该类型的值

(&MutByteSpan) u8_at

XuAPI
pub fn (s &MutByteSpan) u8_at(i int) u8

用途

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

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)

返回值

u8 — 该类型的值

(&MutByteSpan) set_u8

XuAPI
pub fn (s &MutByteSpan) set_u8(i int, v u8) int

用途

&MutByteSpan 上的操作:设置 u8。失败时抛出错误,调用方需处理或继续传播。

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)
v u8
值(u8)

返回值

int — 该类型的值

(&MutByteSpan) u16_be

XuAPI
pub fn (s &MutByteSpan) u16_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&MutByteSpan) u32_be

XuAPI
pub fn (s &MutByteSpan) u32_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&MutByteSpan) u64_be

XuAPI
pub fn (s &MutByteSpan) u64_be(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&MutByteSpan) u32_le

XuAPI
pub fn (s &MutByteSpan) u32_le(off int) int

用途

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

参数

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

返回值

int — 该类型的值

(&MutByteSpan) fill

XuAPI
pub fn (s &MutByteSpan) fill(b u8)

用途

在 &MutByteSpan 上执行 fill 操作。

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
b u8
b(u8)

返回值

不返回值。

(&MutByteSpan) copy_from

XuAPI
pub fn (s &MutByteSpan) copy_from(src &ByteSpan) int

用途

&MutByteSpan 上的操作:拷贝从。

参数

s &MutByteSpan
本次调用使用的 MutByteSpan 实例;以只读借用传入,调用方仍持有实例。
src &ByteSpan
源数据(只读借用,调用方仍持有原值;类型 &ByteSpan)

返回值

int — 该类型的值

(&MutByteSpan) to_bytes

XuAPI
pub fn (s &MutByteSpan) to_bytes() []u8

用途

&MutByteSpan 上的操作:转换为 bytes。

参数

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

返回值

[]u8 — 切片结果

(&F32Span) len

XuAPI
pub fn (s &F32Span) len() int

用途

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

参数

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

返回值

int — 该类型的值

(&F32Span) is_empty

XuAPI
pub fn (s &F32Span) is_empty() bool

用途

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

参数

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

返回值

bool — 是否成立

(&F32Span) sub

XuAPI
pub fn (s &F32Span) sub(lo int, hi int) F32Span

用途

&F32Span 上的操作:相减。失败时抛出错误,调用方需处理或继续传播。

参数

s &F32Span
本次调用使用的 F32Span 实例;以只读借用传入,调用方仍持有实例。
lo int
lo(int)
hi int
hi(int)

返回值

F32Span — 该类型的值

(&F32Span) f32_at

XuAPI
pub fn (s &F32Span) f32_at(i int) f32

用途

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

参数

s &F32Span
本次调用使用的 F32Span 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)

返回值

f32 — 该类型的值

(&MutF32Span) len

XuAPI
pub fn (s &MutF32Span) len() int

用途

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

参数

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

返回值

int — 该类型的值

(&MutF32Span) is_empty

XuAPI
pub fn (s &MutF32Span) is_empty() bool

用途

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

参数

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

返回值

bool — 是否成立

(&MutF32Span) as_span

XuAPI
pub fn (s &MutF32Span) as_span() F32Span

用途

&MutF32Span 上的操作:执行 as span 操作。

参数

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

返回值

F32Span — 该类型的值

(&MutF32Span) sub

XuAPI
pub fn (s &MutF32Span) sub(lo int, hi int) MutF32Span

用途

&MutF32Span 上的操作:相减。失败时抛出错误,调用方需处理或继续传播。

参数

s &MutF32Span
本次调用使用的 MutF32Span 实例;以只读借用传入,调用方仍持有实例。
lo int
lo(int)
hi int
hi(int)

返回值

MutF32Span — 该类型的值

(&MutF32Span) f32_at

XuAPI
pub fn (s &MutF32Span) f32_at(i int) f32

用途

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

参数

s &MutF32Span
本次调用使用的 MutF32Span 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)

返回值

f32 — 该类型的值

(&MutF32Span) set_f32

XuAPI
pub fn (s &MutF32Span) set_f32(i int, v f32) int

用途

&MutF32Span 上的操作:设置 f32。失败时抛出错误,调用方需处理或继续传播。

参数

s &MutF32Span
本次调用使用的 MutF32Span 实例;以只读借用传入,调用方仍持有实例。
i int
下标或整数(int)
v f32
值(f32)

返回值

int — 该类型的值

make_plane

XuAPI
pub fn make_plane(ptr c_ptr, w int, h int, stride int, bpp int) PlaneView

用途

执行 make plane 操作。失败时抛出错误,调用方需处理或继续传播。

参数

ptr c_ptr
ptr(c_ptr)
w int
写入侧 / 宽度(int)
h int
高度或句柄(int)
stride int
stride(int)
bpp int
bpp(int)

返回值

PlaneView — 该类型的值

make_plane_mut

XuAPI
pub fn make_plane_mut(ptr c_ptr, w int, h int, stride int, bpp int) MutPlaneView

用途

执行 make plane mut 操作。失败时抛出错误,调用方需处理或继续传播。

参数

ptr c_ptr
ptr(c_ptr)
w int
写入侧 / 宽度(int)
h int
高度或句柄(int)
stride int
stride(int)
bpp int
bpp(int)

返回值

MutPlaneView — 该类型的值

(&PlaneView) row

XuAPI
pub fn (p &PlaneView) row(y int) ByteSpan

用途

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

参数

p &PlaneView
本次调用使用的 PlaneView 实例;以只读借用传入,调用方仍持有实例。
y int
值(int)

返回值

ByteSpan — 该类型的值

(&PlaneView) sub_rect

XuAPI
pub fn (p &PlaneView) sub_rect(x int, y int, w int, h int) PlaneView

用途

&PlaneView 上的操作:子树矩形。失败时抛出错误,调用方需处理或继续传播。

参数

p &PlaneView
本次调用使用的 PlaneView 实例;以只读借用传入,调用方仍持有实例。
x int
值(int)
y int
值(int)
w int
写入侧 / 宽度(int)
h int
高度或句柄(int)

返回值

PlaneView — 该类型的值

(&MutPlaneView) as_plane

XuAPI
pub fn (p &MutPlaneView) as_plane() PlaneView

用途

&MutPlaneView 上的操作:执行 as plane 操作。

参数

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

返回值

PlaneView — 该类型的值

(&MutPlaneView) row

XuAPI
pub fn (p &MutPlaneView) row(y int) ByteSpan

用途

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

参数

p &MutPlaneView
本次调用使用的 MutPlaneView 实例;以只读借用传入,调用方仍持有实例。
y int
值(int)

返回值

ByteSpan — 该类型的值

(&MutPlaneView) row_mut

XuAPI
pub fn (p &MutPlaneView) row_mut(y int) MutByteSpan

用途

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

参数

p &MutPlaneView
本次调用使用的 MutPlaneView 实例;以只读借用传入,调用方仍持有实例。
y int
值(int)

返回值

MutByteSpan — 该类型的值

(&MutPlaneView) sub_rect

XuAPI
pub fn (p &MutPlaneView) sub_rect(x int, y int, w int, h int) MutPlaneView

用途

&MutPlaneView 上的操作:子树矩形。失败时抛出错误,调用方需处理或继续传播。

参数

p &MutPlaneView
本次调用使用的 MutPlaneView 实例;以只读借用传入,调用方仍持有实例。
x int
值(int)
y int
值(int)
w int
写入侧 / 宽度(int)
h int
高度或句柄(int)

返回值

MutPlaneView — 该类型的值