pub struct EnergyDevice(pub Address);Expand description
The energy_device component (4 methods).
Provided by OpenComputers’ DriverEnergyStorage$Environment.
Tuple Fields§
§0: AddressImplementations§
Source§impl EnergyDevice
impl EnergyDevice
Sourcepub fn can_extract(&self) -> Result<bool>
pub fn can_extract(&self) -> Result<bool>
Returns whether this component can have energy extracted from the connected side.
Lua: energy_device.canExtract():boolean
Indirect call: waits for the next server tick.
Sourcepub async fn can_extract_async(&self) -> Result<bool>
pub async fn can_extract_async(&self) -> Result<bool>
Self::can_extract without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn can_receive(&self) -> Result<bool>
pub fn can_receive(&self) -> Result<bool>
Returns whether this component can receive energy on the connected side.
Lua: energy_device.canReceive():boolean
Indirect call: waits for the next server tick.
Sourcepub async fn can_receive_async(&self) -> Result<bool>
pub async fn can_receive_async(&self) -> Result<bool>
Self::can_receive without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_energy_stored(&self) -> Result<Number>
pub fn get_energy_stored(&self) -> Result<Number>
Returns the amount of stored energy on the connected side.
Lua: energy_device.getEnergyStored():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_energy_stored_async(&self) -> Result<Number>
pub async fn get_energy_stored_async(&self) -> Result<Number>
Self::get_energy_stored without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_max_energy_stored(&self) -> Result<Number>
pub fn get_max_energy_stored(&self) -> Result<Number>
Returns the maximum amount of stored energy on the connected side.
Lua: energy_device.getMaxEnergyStored():number
Indirect call: waits for the next server tick.
Sourcepub async fn get_max_energy_stored_async(&self) -> Result<Number>
pub async fn get_max_energy_stored_async(&self) -> Result<Number>
Self::get_max_energy_stored 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 EnergyDevice
impl Clone for EnergyDevice
Source§impl Component for EnergyDevice
impl Component for EnergyDevice
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.