Struct cameleon::genapi::ParamsCtxt
source · pub struct ParamsCtxt<Ctrl, Ctxt> {
pub ctrl: Ctrl,
pub ctxt: Ctxt,
}
Expand description
Manages context of parameters of the device.
Examples
// Loads `GenApi` context.
camera.load_context().unwrap();
let mut params_ctxt = camera.params_ctxt().unwrap();
// Get `Gain` node of `GenApi`.
// `GenApi SFNC` defines that `Gain` node should have `IFloat` interface,
// so this conversion would be success if the camera follows that.
// Some vendors may define `Gain` node as `IInteger`, in that case, use
// `as_integer(¶ms_ctxt)` instead of `as_float(¶ms_ctxt).
let gain_node = params_ctxt.node("Gain").unwrap().as_float(¶ms_ctxt).unwrap();
// Get the current value of `Gain`.
if gain_node.is_readable(&mut params_ctxt).unwrap() {
let value = gain_node.value(&mut params_ctxt).unwrap();
println!("{}", value);
}
// Set `0.1` to `Gain`.
if gain_node.is_writable(&mut params_ctxt).unwrap() {
gain_node.set_value(&mut params_ctxt, 0.1).unwrap();
}
Fields§
§ctrl: Ctrl
Control handle of the device.
ctxt: Ctxt
GenApi
context of the device.
Implementations§
source§impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>where
Ctxt: GenApiCtxt,
impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>where Ctxt: GenApiCtxt,
source§impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>where
Ctrl: DeviceControl,
Ctxt: GenApiCtxt,
impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>where Ctrl: DeviceControl, Ctxt: GenApiCtxt,
source§impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>
impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>
sourcepub fn convert_from<Ctrl2, Ctxt2>(from: ParamsCtxt<Ctrl2, Ctxt2>) -> Selfwhere
Ctrl: From<Ctrl2>,
Ctxt: From<Ctxt2>,
pub fn convert_from<Ctrl2, Ctxt2>(from: ParamsCtxt<Ctrl2, Ctxt2>) -> Selfwhere Ctrl: From<Ctrl2>, Ctxt: From<Ctxt2>,
Converts internal types. This method work same as std::convert::From
, just hack to avoid
E0119
.
sourcepub fn convert_into<Ctrl2, Ctxt2>(self) -> ParamsCtxt<Ctrl2, Ctxt2>where
Ctrl: Into<Ctrl2>,
Ctxt: Into<Ctxt2>,
pub fn convert_into<Ctrl2, Ctxt2>(self) -> ParamsCtxt<Ctrl2, Ctxt2>where Ctrl: Into<Ctrl2>, Ctxt: Into<Ctxt2>,
Converts internal types. This method work same as std::convert::Into
, just hack to avoid
E0119
.
Trait Implementations§
Auto Trait Implementations§
impl<Ctrl, Ctxt> RefUnwindSafe for ParamsCtxt<Ctrl, Ctxt>where Ctrl: RefUnwindSafe, Ctxt: RefUnwindSafe,
impl<Ctrl, Ctxt> Send for ParamsCtxt<Ctrl, Ctxt>where Ctrl: Send, Ctxt: Send,
impl<Ctrl, Ctxt> Sync for ParamsCtxt<Ctrl, Ctxt>where Ctrl: Sync, Ctxt: Sync,
impl<Ctrl, Ctxt> Unpin for ParamsCtxt<Ctrl, Ctxt>where Ctrl: Unpin, Ctxt: Unpin,
impl<Ctrl, Ctxt> UnwindSafe for ParamsCtxt<Ctrl, Ctxt>where Ctrl: UnwindSafe, Ctxt: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more