pub struct Eeprom(pub Address);Expand description
The eeprom component (10 methods).
Provided by OpenComputers’ EEPROM.
Tuple Fields§
§0: AddressImplementations§
Source§impl Eeprom
impl Eeprom
Sourcepub fn get(&self) -> Result<OcString>
pub fn get(&self) -> Result<OcString>
Get the currently stored byte array.
Lua: eeprom.get():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_async(&self) -> Result<OcString>
pub async fn get_async(&self) -> Result<OcString>
Self::get without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_checksum(&self) -> Result<OcString>
pub fn get_checksum(&self) -> Result<OcString>
Get the checksum of the data on this EEPROM.
Lua: eeprom.getChecksum():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_checksum_async(&self) -> Result<OcString>
pub async fn get_checksum_async(&self) -> Result<OcString>
Self::get_checksum without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_data(&self) -> Result<OcString>
pub fn get_data(&self) -> Result<OcString>
Get the currently stored byte array.
Lua: eeprom.getData():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_data_async(&self) -> Result<OcString>
pub async fn get_data_async(&self) -> Result<OcString>
Self::get_data without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_data_size(&self) -> Result<Number>
pub fn get_data_size(&self) -> Result<Number>
Get the storage capacity of this EEPROM.
Lua: eeprom.getDataSize():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_data_size_async(&self) -> Result<Number>
pub async fn get_data_size_async(&self) -> Result<Number>
Self::get_data_size without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_label(&self) -> Result<OcString>
pub fn get_label(&self) -> Result<OcString>
Get the label of the EEPROM.
Lua: eeprom.getLabel():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_label_async(&self) -> Result<OcString>
pub async fn get_label_async(&self) -> Result<OcString>
Self::get_label without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_size(&self) -> Result<Number>
pub fn get_size(&self) -> Result<Number>
Get the storage capacity of this EEPROM.
Lua: eeprom.getSize():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_size_async(&self) -> Result<Number>
pub async fn get_size_async(&self) -> Result<Number>
Self::get_size without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn make_readonly(&self, checksum: impl AsRef<[u8]>) -> Result<bool>
pub fn make_readonly(&self, checksum: impl AsRef<[u8]>) -> Result<bool>
Make this EEPROM readonly if it isn’t already. This process cannot be reversed!
Lua: eeprom.makeReadonly(checksum:string):boolean
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn make_readonly_async(
&self,
checksum: impl AsRef<[u8]>,
) -> Result<bool>
pub async fn make_readonly_async( &self, checksum: impl AsRef<[u8]>, ) -> Result<bool>
Self::make_readonly without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set(&self, data: impl AsRef<[u8]>) -> Result<()>
pub fn set(&self, data: impl AsRef<[u8]>) -> Result<()>
Overwrite the currently stored byte array.
Lua: eeprom.set(data:string)
Indirect call: waits for the next server tick.
Sourcepub async fn set_async(&self, data: impl AsRef<[u8]>) -> Result<()>
pub async fn set_async(&self, data: impl AsRef<[u8]>) -> Result<()>
Self::set without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_data(&self, data: impl AsRef<[u8]>) -> Result<()>
pub fn set_data(&self, data: impl AsRef<[u8]>) -> Result<()>
Overwrite the currently stored byte array.
Lua: eeprom.setData(data:string)
Indirect call: waits for the next server tick.
Sourcepub async fn set_data_async(&self, data: impl AsRef<[u8]>) -> Result<()>
pub async fn set_data_async(&self, data: impl AsRef<[u8]>) -> Result<()>
Self::set_data without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_label(&self, data: impl AsRef<[u8]>) -> Result<OcString>
pub fn set_label(&self, data: impl AsRef<[u8]>) -> Result<OcString>
Set the label of the EEPROM.
Lua: eeprom.setLabel(data:string):string
Indirect call: waits for the next server tick.
Sourcepub async fn set_label_async(&self, data: impl AsRef<[u8]>) -> Result<OcString>
pub async fn set_label_async(&self, data: impl AsRef<[u8]>) -> Result<OcString>
Self::set_label 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 Eeprom
impl Component for Eeprom
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.