pub struct Computer(pub Address);Expand description
The computer component (6 methods).
Provided by OpenComputers’ MachineBase.
Tuple Fields§
§0: AddressImplementations§
Source§impl Computer
impl Computer
Sourcepub fn beep(
&self,
frequency: Option<Value>,
duration: Option<Number>,
) -> Result<()>
pub fn beep( &self, frequency: Option<Value>, duration: Option<Number>, ) -> Result<()>
Plays a tone, useful to alert users via audible feedback.
Lua: computer.beep([frequency:string or number[, duration:number]])
Indirect call: waits for the next server tick.
Sourcepub async fn beep_async(
&self,
frequency: Option<Value>,
duration: Option<Number>,
) -> Result<()>
pub async fn beep_async( &self, frequency: Option<Value>, duration: Option<Number>, ) -> Result<()>
Self::beep without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_device_info(&self) -> Result<Value>
pub fn get_device_info(&self) -> Result<Value>
Collect information on all connected devices.
Lua: computer.getDeviceInfo():table
Indirect call: waits for the next server tick.
Sourcepub async fn get_device_info_async(&self) -> Result<Value>
pub async fn get_device_info_async(&self) -> Result<Value>
Self::get_device_info without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_program_locations(&self) -> Result<Value>
pub fn get_program_locations(&self) -> Result<Value>
Returns a map of program name to disk label for known programs.
Lua: computer.getProgramLocations():table
Indirect call: waits for the next server tick.
Sourcepub async fn get_program_locations_async(&self) -> Result<Value>
pub async fn get_program_locations_async(&self) -> Result<Value>
Self::get_program_locations without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn is_running(&self) -> Result<bool>
pub fn is_running(&self) -> Result<bool>
Returns whether the computer is running.
Lua: computer.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 start(&self) -> Result<bool>
pub fn start(&self) -> Result<bool>
Starts the computer. Returns true if the state changed.
Lua: computer.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 computer. Returns true if the state changed.
Lua: computer.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 Component for Computer
impl Component for Computer
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.