Skip to main content

ObservationSession

Trait ObservationSession 

Source
pub trait ObservationSession: Send {
    // Required methods
    fn profile(&self) -> &DeviceProfile;
    fn start(&mut self) -> DeviceResult<()>;
    fn poll(&mut self, kind: &str) -> DeviceResult<Option<Expr>>;
    fn stop(&mut self) -> DeviceResult<()>;
}
Expand description

Open read-only stream-device session.

This trait deliberately has no downcast hook and no generic command method. A caller holding this object can only observe and release the device.

fn hostile_caller(session: &mut dyn ObservationSession, request: EffectRequest) {
    session.invoke(request); // observation authority has no invocation escape
}

Required Methods§

Source

fn profile(&self) -> &DeviceProfile

Returns the profile for this session.

Source

fn start(&mut self) -> DeviceResult<()>

Starts sample processing.

Source

fn poll(&mut self, kind: &str) -> DeviceResult<Option<Expr>>

Polls one sample expression for kind.

Source

fn stop(&mut self) -> DeviceResult<()>

Stops sample processing and releases session resources.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§