Trait realsense_rust::frame::FrameCategory [−][src]
pub trait FrameCategory { 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:
- The data format (
Rs2Format
) - The extension type (
Rs2Extension
- 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
fn extension() -> Rs2Extension
fn extension() -> Rs2Extension
Identifies the corresponding Rs2Extension
for the type implementing this trait.
fn kind() -> Rs2StreamKind
fn kind() -> Rs2StreamKind
Identifies the stream kind corresponding to a given type implementing this trait.
fn has_correct_kind(&self) -> bool
fn has_correct_kind(&self) -> bool
Predicate for checking if the RS2 frame’s stream has the same kind as the frame category.