XU XUv0.16.0

#bytes/span

import: #bytes/span

counts: 11 functions, 40 methods, 8 types, 0 constants, 0 method sets

Zero-copy non-owning descriptor views over caller-owned memory, slices, strings, mmap mappings, and aligned buffers, plus 2D strided multi-plane image/video views.

struct ByteSpan

XuAPI
pub struct ByteSpan {

}

Purpose

ByteSpan context or state structure.

Public fields

This type has no public fields.

struct MutByteSpan

XuAPI
pub struct MutByteSpan {

}

Purpose

MutByteSpan context or state structure.

Public fields

This type has no public fields.

struct F32Span

XuAPI
pub struct F32Span {

}

Purpose

F32Span context or state structure.

Public fields

This type has no public fields.

struct MutF32Span

XuAPI
pub struct MutF32Span {

}

Purpose

MutF32Span context or state structure.

Public fields

This type has no public fields.

struct ByteSpanPair

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

Purpose

Structure encapsulating left, right.

Public fields

left ByteSpan
field (ByteSpan)
right ByteSpan
field (ByteSpan)

struct MutByteSpanPair

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

Purpose

Structure encapsulating left, right.

Public fields

left MutByteSpan
field (MutByteSpan)
right MutByteSpan
field (MutByteSpan)

struct PlaneView

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

Purpose

Structure encapsulating ptr, width, height, stride, bpp.

Public fields

ptr c_ptr
field (c_ptr)
width int
field (int)
height int
field (int)
stride int
field (int)
bpp int
field (int)

struct MutPlaneView

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

Purpose

Structure encapsulating ptr, width, height, stride, bpp.

Public fields

ptr c_ptr
field (c_ptr)
width int
field (int)
height int
field (int)
stride int
field (int)
bpp int
field (int)

empty_bytes

XuAPI
pub fn empty_bytes() ByteSpan

Purpose

Empty bytes.

Parameters

No arguments are required.

Returns

ByteSpan — a value of this type

empty_mut_bytes

XuAPI
pub fn empty_mut_bytes() MutByteSpan

Purpose

Empty mut bytes.

Parameters

No arguments are required.

Returns

MutByteSpan — a value of this type

empty_f32

XuAPI
pub fn empty_f32() F32Span

Purpose

Empty f32.

Parameters

No arguments are required.

Returns

F32Span — a value of this type

empty_mut_f32

XuAPI
pub fn empty_mut_f32() MutF32Span

Purpose

Empty mut f32.

Parameters

No arguments are required.

Returns

MutF32Span — a value of this type

from_bytes

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

Purpose

Non-owning view over caller-owned slice/string lifetime.

Parameters

b &[]u8
slice to operate on (read-only borrow; caller keeps the original; type &[]u8)

Returns

ByteSpan — a value of this type

from_bytes_mut

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

Purpose

Build from bytes mut.

Parameters

b $&[]u8
slice to operate on (exclusive borrow; may modify the original; type $&[]u8)

Returns

MutByteSpan — a value of this type

from_string

XuAPI
pub fn from_string(s &string) ByteSpan

Purpose

Build from string.

Parameters

s &string
source string (read-only borrow; caller keeps the original; type &string)

Returns

ByteSpan — a value of this type

from_f32

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

Purpose

Build from f32.

Parameters

f &[]f32
callback or format string (read-only borrow; caller keeps the original; type &[]f32)

Returns

F32Span — a value of this type

from_f32_mut

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

Purpose

Build from f32 mut.

Parameters

f $&[]f32
callback or format string (exclusive borrow; may modify the original; type $&[]f32)

Returns

MutF32Span — a value of this type

(&ByteSpan) len

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

Purpose

Operation on &ByteSpan: return the length.

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).

Returns

int — a value of this type

(&ByteSpan) is_empty

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

Purpose

Operation on &ByteSpan: whether it is empty.

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).

Returns

bool — true or false

(&ByteSpan) sub

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
lo int
lo (int)
hi int
hi (int)

Returns

ByteSpan — a value of this type

(&ByteSpan) split_at

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
mid int
mid (int)

Returns

ByteSpanPair — a value of this type

(&ByteSpan) u8_at

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
i int
index or integer (int)

Returns

u8 — a value of this type

(&ByteSpan) u16_be

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&ByteSpan) u32_be

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&ByteSpan) u64_be

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&ByteSpan) u32_le

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

Purpose

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

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&ByteSpan) to_bytes

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

Purpose

Operation on &ByteSpan: convert to bytes.

Parameters

s &ByteSpan
The ByteSpan instance used by this call (borrow).

Returns

[]u8 — slice result

(&MutByteSpan) len

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

Purpose

Operation on &MutByteSpan: return the length.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).

Returns

int — a value of this type

(&MutByteSpan) is_empty

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

Purpose

Operation on &MutByteSpan: whether it is empty.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).

Returns

bool — true or false

(&MutByteSpan) as_span

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

Purpose

Operation on &MutByteSpan: as span.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).

Returns

ByteSpan — a value of this type

(&MutByteSpan) sub

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
lo int
lo (int)
hi int
hi (int)

Returns

MutByteSpan — a value of this type

(&MutByteSpan) split_at_mut

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

Purpose

Operation on &MutByteSpan: split at mut. Throws on failure; handle the error or propagate it to the caller.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
mid int
mid (int)

Returns

MutByteSpanPair — a value of this type

(&MutByteSpan) u8_at

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
i int
index or integer (int)

Returns

u8 — a value of this type

(&MutByteSpan) set_u8

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

Purpose

Operation on &MutByteSpan: set u8. Throws on failure; handle the error or propagate it to the caller.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
i int
index or integer (int)
v u8
value (u8)

Returns

int — a value of this type

(&MutByteSpan) u16_be

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&MutByteSpan) u32_be

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&MutByteSpan) u64_be

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&MutByteSpan) u32_le

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

Purpose

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

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
off int
offset (int)

Returns

int — a value of this type

(&MutByteSpan) fill

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

Purpose

Execute fill on &MutByteSpan.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
b u8
b (u8)

Returns

This call does not return a value.

(&MutByteSpan) copy_from

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

Purpose

Operation on &MutByteSpan: copy from.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).
src &ByteSpan
source (read-only borrow; caller keeps the original; type &ByteSpan)

Returns

int — a value of this type

(&MutByteSpan) to_bytes

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

Purpose

Operation on &MutByteSpan: convert to bytes.

Parameters

s &MutByteSpan
The MutByteSpan instance used by this call (borrow).

Returns

[]u8 — slice result

(&F32Span) len

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

Purpose

Operation on &F32Span: return the length.

Parameters

s &F32Span
The F32Span instance used by this call (borrow).

Returns

int — a value of this type

(&F32Span) is_empty

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

Purpose

Operation on &F32Span: whether it is empty.

Parameters

s &F32Span
The F32Span instance used by this call (borrow).

Returns

bool — true or false

(&F32Span) sub

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

Purpose

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

Parameters

s &F32Span
The F32Span instance used by this call (borrow).
lo int
lo (int)
hi int
hi (int)

Returns

F32Span — a value of this type

(&F32Span) f32_at

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

Purpose

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

Parameters

s &F32Span
The F32Span instance used by this call (borrow).
i int
index or integer (int)

Returns

f32 — a value of this type

(&MutF32Span) len

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

Purpose

Operation on &MutF32Span: return the length.

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).

Returns

int — a value of this type

(&MutF32Span) is_empty

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

Purpose

Operation on &MutF32Span: whether it is empty.

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).

Returns

bool — true or false

(&MutF32Span) as_span

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

Purpose

Operation on &MutF32Span: as span.

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).

Returns

F32Span — a value of this type

(&MutF32Span) sub

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

Purpose

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

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).
lo int
lo (int)
hi int
hi (int)

Returns

MutF32Span — a value of this type

(&MutF32Span) f32_at

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

Purpose

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

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).
i int
index or integer (int)

Returns

f32 — a value of this type

(&MutF32Span) set_f32

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

Purpose

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

Parameters

s &MutF32Span
The MutF32Span instance used by this call (borrow).
i int
index or integer (int)
v f32
value (f32)

Returns

int — a value of this type

make_plane

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

Purpose

Make plane. Throws on failure; handle the error or propagate it to the caller.

Parameters

ptr c_ptr
ptr (c_ptr)
w int
writer or width (int)
h int
height or handle (int)
stride int
stride (int)
bpp int
bpp (int)

Returns

PlaneView — a value of this type

make_plane_mut

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

Purpose

Make plane mut. Throws on failure; handle the error or propagate it to the caller.

Parameters

ptr c_ptr
ptr (c_ptr)
w int
writer or width (int)
h int
height or handle (int)
stride int
stride (int)
bpp int
bpp (int)

Returns

MutPlaneView — a value of this type

(&PlaneView) row

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

Purpose

Execute row on &PlaneView. Throws on failure; handle the error or propagate it to the caller.

Parameters

p &PlaneView
The PlaneView instance used by this call (borrow).
y int
value (int)

Returns

ByteSpan — a value of this type

(&PlaneView) sub_rect

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

Purpose

Operation on &PlaneView: sub rectangle. Throws on failure; handle the error or propagate it to the caller.

Parameters

p &PlaneView
The PlaneView instance used by this call (borrow).
x int
value (int)
y int
value (int)
w int
writer or width (int)
h int
height or handle (int)

Returns

PlaneView — a value of this type

(&MutPlaneView) as_plane

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

Purpose

Operation on &MutPlaneView: as plane.

Parameters

p &MutPlaneView
The MutPlaneView instance used by this call (borrow).

Returns

PlaneView — a value of this type

(&MutPlaneView) row

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

Purpose

Execute row on &MutPlaneView. Throws on failure; handle the error or propagate it to the caller.

Parameters

p &MutPlaneView
The MutPlaneView instance used by this call (borrow).
y int
value (int)

Returns

ByteSpan — a value of this type

(&MutPlaneView) row_mut

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

Purpose

Operation on &MutPlaneView: row mut. Throws on failure; handle the error or propagate it to the caller.

Parameters

p &MutPlaneView
The MutPlaneView instance used by this call (borrow).
y int
value (int)

Returns

MutByteSpan — a value of this type

(&MutPlaneView) sub_rect

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

Purpose

Operation on &MutPlaneView: sub rectangle. Throws on failure; handle the error or propagate it to the caller.

Parameters

p &MutPlaneView
The MutPlaneView instance used by this call (borrow).
x int
value (int)
y int
value (int)
w int
writer or width (int)
h int
height or handle (int)

Returns

MutPlaneView — a value of this type