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

Method export_state

rustcv-backend-v4l2/src/controls.rs:125–138  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

123 }
124
125 fn export_state(&self) -> Result<serde_json::Value> {
126 use serde_json::json;
127
128 // 使用我们定义的常量
129 let exp = self.dev.control(CID_EXPOSURE_ABSOLUTE).ok();
130 let gain = self.dev.control(CID_GAIN).ok();
131
132 Ok(json!({
133 "backend": "v4l2",
134 // 这里的 Value 实现了 Debug,可以直接 format!
135 "exposure": exp.map(|v| format!("{:?}", v.value)),
136 "gain": gain.map(|v| format!("{:?}", v.value)),
137 }))
138 }
139}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected