pub struct Microcontroller(pub Address);Expand description
The microcontroller component (6 methods).
Provided by OpenComputers’ Microcontroller.
Tuple Fields§
§0: AddressImplementations§
Source§impl Microcontroller
impl Microcontroller
Sourcepub fn is_running(&self) -> Result<bool>
pub fn is_running(&self) -> Result<bool>
Returns whether the microcontroller is running.
Lua: microcontroller.isRunning():boolean
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn is_running_async(&self) -> Result<bool>
pub async fn is_running_async(&self) -> Result<bool>
Self::is_running without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn is_side_open(&self, side: impl Into<Number>) -> Result<bool>
pub fn is_side_open(&self, side: impl Into<Number>) -> Result<bool>
Get whether network messages are sent via the specified side.
Lua: microcontroller.isSideOpen(side:number):boolean
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn is_side_open_async(&self, side: impl Into<Number>) -> Result<bool>
pub async fn is_side_open_async(&self, side: impl Into<Number>) -> Result<bool>
Self::is_side_open without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn last_error(&self) -> Result<OcString>
pub fn last_error(&self) -> Result<OcString>
Returns the reason the microcontroller crashed, if applicable.
Lua: microcontroller.lastError():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn last_error_async(&self) -> Result<OcString>
pub async fn last_error_async(&self) -> Result<OcString>
Self::last_error without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_side_open(&self, side: impl Into<Number>, open: bool) -> Result<bool>
pub fn set_side_open(&self, side: impl Into<Number>, open: bool) -> Result<bool>
Set whether network messages are sent via the specified side.
Lua: microcontroller.setSideOpen(side:number, open:boolean):boolean
Indirect call: waits for the next server tick.
Sourcepub async fn set_side_open_async(
&self,
side: impl Into<Number>,
open: bool,
) -> Result<bool>
pub async fn set_side_open_async( &self, side: impl Into<Number>, open: bool, ) -> Result<bool>
Self::set_side_open without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn start(&self) -> Result<bool>
pub fn start(&self) -> Result<bool>
Starts the microcontroller. Returns true if the state changed.
Lua: microcontroller.start():boolean
Indirect call: waits for the next server tick.
Sourcepub async fn start_async(&self) -> Result<bool>
pub async fn start_async(&self) -> Result<bool>
Self::start without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn stop(&self) -> Result<bool>
pub fn stop(&self) -> Result<bool>
Stops the microcontroller. Returns true if the state changed.
Lua: microcontroller.stop():boolean
Indirect call: waits for the next server tick.
Sourcepub async fn stop_async(&self) -> Result<bool>
pub async fn stop_async(&self) -> Result<bool>
Self::stop 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 Microcontroller
impl Clone for Microcontroller
Source§impl Component for Microcontroller
impl Component for Microcontroller
Source§fn from_address(address: Address) -> Self
fn from_address(address: Address) -> Self
fn address(&self) -> &Address
Source§fn at(address: impl Into<Address>) -> Option<Self>
fn at(address: impl Into<Address>) -> Option<Self>
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>>
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.