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(&params_ctxt)` instead of `as_float(&params_ctxt).
let gain_node = params_ctxt.node("Gain").unwrap().as_float(&params_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,

source

pub fn node(&self, name: &str) -> Option<Node>

Returns None if there is node node with the given name in the context.

source

pub fn node_store(&self) -> &Ctxt::NS

Returns NodeStore in the context.

source§

impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>where Ctrl: DeviceControl, Ctxt: GenApiCtxt,

source

pub fn enter<F, R>(&mut self, f: F) -> Rwhere F: FnOnce(&mut Ctrl, &mut Ctxt) -> R,

Enters the context.

source

pub fn enter2<F, R>(&mut self, f: F) -> Rwhere F: FnOnce(&mut Ctrl, &Ctxt::NS, &mut ValueCtxt<Ctxt::VS, Ctxt::CS>) -> R,

Enters the context and then enters GenApiCtxt.

source§

impl<Ctrl, Ctxt> ParamsCtxt<Ctrl, Ctxt>

source

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.

source

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§

source§

impl<Ctrl: Clone, Ctxt: Clone> Clone for ParamsCtxt<Ctrl, Ctxt>

source§

fn clone(&self) -> ParamsCtxt<Ctrl, Ctxt>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Ctrl: Debug, Ctxt: Debug> Debug for ParamsCtxt<Ctrl, Ctxt>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more