Struct Device

Source
pub struct Device { /* private fields */ }
Expand description

A type representing a RealSense device.

A device in librealsense2 corresponds to a physical unit that connects to your computer (usually via USB). Devices hold a list of sensors, which in turn are represented by a list of streams producing frames.

Devices are usually acquired by the driver context.

Implementations§

Source§

impl Device

Source

pub fn sensors(&self) -> Vec<Sensor>

Gets a list of sensors associated with the device.

Returns a vector of zero size if any error occurs while trying to read the sensor list. This can occur if the physical device is disconnected before this call is made.

Source

pub fn hardware_reset(self)

Takes ownership of the device and forces a hardware reset on the device.

Ownership of the device is taken as the underlying state can no longer be safely retained after resetting the device.

Source

pub fn info(&self, camera_info: Rs2CameraInfo) -> Option<&CStr>

Gets the value associated with the provided camera info key from the device.

Returns some information value associated with the camera info key if the camera_info is supported by the device, else it returns None.

Source

pub fn supports_info(&self, camera_info: Rs2CameraInfo) -> bool

Predicate for checking if camera_info is supported for this device.

Returns true iff the device has a value associated with the camera_info key.

Trait Implementations§

Source§

impl Debug for Device

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for Device

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<NonNull<rs2_device>> for Device

Source§

fn from(device_ptr: NonNull<rs2_device>) -> Self

Attempt to construct a Device from a non-null pointer to rs2_device.

Constructs a device from a pointer to an rs2_device type from the C-FFI.

Source§

impl Send for Device

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.