Trait FrameCategory

Source
pub trait FrameCategory {
    // Required methods
    fn extension() -> Rs2Extension;
    fn kind() -> Rs2StreamKind;
    fn has_correct_kind(&self) -> bool;
}
Expand description

A trait for specifying which runtime stream kinds can be held within a frame type

This trait changes some of the semantics for how to think about librealsense2 frames. The reason for this is because frames in librealsense2 are more or less defined by three things:

  1. The data format (Rs2Format)
  2. The extension type (Rs2Extension
  3. The “stream kind” (Rs2StreamKind)

Knowing these three things, you can uniquely describe any frame. We aim for our types to be categorically distinct. Unfortunately, all three of the data points above are not encoded in the type information for a frame in librealsense2, but are rather things we check at runtime.

Required Methods§

Source

fn extension() -> Rs2Extension

Identifies the corresponding Rs2Extension for the type implementing this trait.

Source

fn kind() -> Rs2StreamKind

Identifies the stream kind corresponding to a given type implementing this trait.

Source

fn has_correct_kind(&self) -> bool

Predicate for checking if the RS2 frame’s stream has the same kind as the frame category.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§