pub struct MotionSensor(pub Address);Expand description
The motion_sensor component (2 methods).
Provided by OpenComputers’ MotionSensor.
Tuple Fields§
§0: AddressImplementations§
Source§impl MotionSensor
impl MotionSensor
Sourcepub fn get_sensitivity(&self) -> Result<Number>
pub fn get_sensitivity(&self) -> Result<Number>
Gets the current sensor sensitivity.
Lua: motion_sensor.getSensitivity():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_sensitivity_async(&self) -> Result<Number>
pub async fn get_sensitivity_async(&self) -> Result<Number>
Self::get_sensitivity without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_sensitivity(&self, value: impl Into<Number>) -> Result<Number>
pub fn set_sensitivity(&self, value: impl Into<Number>) -> Result<Number>
Sets the sensor’s sensitivity. Returns the old value.
Lua: motion_sensor.setSensitivity(value:number):number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn set_sensitivity_async(
&self,
value: impl Into<Number>,
) -> Result<Number>
pub async fn set_sensitivity_async( &self, value: impl Into<Number>, ) -> Result<Number>
Self::set_sensitivity without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Trait Implementations§
Source§impl Clone for MotionSensor
impl Clone for MotionSensor
Source§impl Component for MotionSensor
impl Component for MotionSensor
Source§fn from_address(address: Address) -> Self
fn from_address(address: Address) -> Self
Wraps an address without checking what is there.
fn address(&self) -> &Address
Source§fn at(address: impl Into<Address>) -> Option<Self>
fn at(address: impl Into<Address>) -> Option<Self>
The component at
address, if it is of this type.Source§fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>>
An untyped call, for methods the wrapper doesn’t know.
Source§fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ
Component::invoke without blocking; see invoke_async.Source§impl Debug for MotionSensor
impl Debug for MotionSensor
impl Eq for MotionSensor
Source§impl Hash for MotionSensor
impl Hash for MotionSensor
Source§impl PartialEq for MotionSensor
impl PartialEq for MotionSensor
impl StructuralPartialEq for MotionSensor
Auto Trait Implementations§
impl Forget for MotionSensor
impl Freeze for MotionSensor
impl Move for MotionSensor
impl RefUnwindSafe for MotionSensor
impl Send for MotionSensor
impl Sync for MotionSensor
impl Unpin for MotionSensor
impl UnsafeUnpin for MotionSensor
impl UnwindSafe for MotionSensor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more