pub struct Experience(pub Address);Expand description
The experience component (2 methods).
Provided by OpenComputers’ UpgradeExperience.
Tuple Fields§
§0: AddressImplementations§
Source§impl Experience
impl Experience
Sourcepub fn consume(&self) -> Result<bool>
pub fn consume(&self) -> Result<bool>
Tries to consume an enchanted item to add experience to the upgrade.
Lua: experience.consume():boolean
Indirect call: waits for the next server tick.
Sourcepub async fn consume_async(&self) -> Result<bool>
pub async fn consume_async(&self) -> Result<bool>
Self::consume without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn level(&self) -> Result<Number>
pub fn level(&self) -> Result<Number>
The current level of experience stored in this experience upgrade.
Lua: experience.level():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn level_async(&self) -> Result<Number>
pub async fn level_async(&self) -> Result<Number>
Self::level 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 Experience
impl Clone for Experience
Source§impl Component for Experience
impl Component for Experience
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 Experience
impl Debug for Experience
impl Eq for Experience
Source§impl Hash for Experience
impl Hash for Experience
Source§impl PartialEq for Experience
impl PartialEq for Experience
impl StructuralPartialEq for Experience
Auto Trait Implementations§
impl Forget for Experience
impl Freeze for Experience
impl Move for Experience
impl RefUnwindSafe for Experience
impl Send for Experience
impl Sync for Experience
impl Unpin for Experience
impl UnsafeUnpin for Experience
impl UnwindSafe for Experience
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