MockController

Struct MockController 

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

A mock display controller for testing.

This allows testing code that depends on DisplayController without requiring actual ASUS hardware or the ASUS DLL.

§Example

use asus_display_control::{MockController, DisplayController, NormalMode};

let mock = MockController::new();
mock.set_mode(&NormalMode::new()).unwrap();
assert_eq!(mock.get_state().mode_id, 1);

Implementations§

Source§

impl MockController

Source

pub fn new() -> Self

Create a new mock controller with default state.

Source

pub fn with_state(state: ControllerState) -> Self

Create a mock controller with custom initial state.

Trait Implementations§

Source§

impl Default for MockController

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl DisplayController for MockController

Source§

fn get_state(&self) -> ControllerState

Get a snapshot of the current controller state.
Source§

fn refresh_sliders(&self) -> Result<(), ControllerError>

Refresh slider values from the device.
Source§

fn sync_all_sliders(&self) -> Result<(), ControllerError>

Sync all slider values from hardware.
Source§

fn set_dimming(&self, level: i32) -> Result<(), ControllerError>

Set the display dimming level (40-100 in splendid units).
Source§

fn set_dimming_percent(&self, percent: i32) -> Result<(), ControllerError>

Set dimming using percentage (0-100).
Source§

fn get_current_mode(&self) -> Result<Box<dyn DisplayMode>, ControllerError>

Get the current display mode.
Source§

fn set_mode(&self, mode: &dyn DisplayMode) -> Result<(), ControllerError>

Set a display mode.
Source§

fn toggle_e_reading(&self) -> Result<Box<dyn DisplayMode>, ControllerError>

Toggle e-reading mode on/off.

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.