MCPcopy Create free account
hub / github.com/RustCV/RustCV / MmapBuffer

Class MmapBuffer

rustcv-camera/src/backend/linux/mod.rs:38–46  ·  view source on GitHub ↗

A single memory-mapped kernel buffer. 单个内核内存映射缓冲区。 Wraps a raw pointer returned by `mmap()`. Implements `Drop` to ensure `munmap()` is called — preventing resource leaks. 封装 `mmap()` 返回的裸指针。 实现 `Drop` 确保调用 `munmap()` —— 防止资源泄漏。

Source from the content-addressed store, hash-verified

36/// 封装 `mmap()` 返回的裸指针。
37/// 实现 `Drop` 确保调用 `munmap()` —— 防止资源泄漏。
38struct MmapBuffer {
39 /// Pointer to the mapped memory region.
40 /// 指向映射内存区域的指针。
41 ptr: *mut u8,
42
43 /// Total size of this buffer in bytes.
44 /// 此缓冲区的总大小(字节)。
45 length: usize,
46}
47
48/// # Safety
49/// mmap buffers are backed by kernel memory with well-defined access semantics.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected