Struct oc_wasm_immersive::engineering::assembler::Locked
source · [−]pub struct Locked<'invoker, 'buffer, B: Buffer> { /* private fields */ }Expand description
An assembler component on which methods can be invoked.
This type combines an assembler address, an Invoker that can be used to make
method calls, and a scratch buffer used to perform CBOR encoding and decoding. A value of this
type can be created by calling Assembler::lock, and it can be dropped to
return the borrow of the invoker and buffer to the caller so they can be reused for other
purposes.
The 'invoker lifetime is the lifetime of the invoker. The 'buffer lifetime is the lifetime
of the buffer. The B type is the type of scratch buffer to use.
Implementations
sourceimpl<'invoker, 'buffer, B: Buffer> Locked<'invoker, 'buffer, B>
impl<'invoker, 'buffer, B: Buffer> Locked<'invoker, 'buffer, B>
sourcepub async fn has_ingredients(&mut self, slot: RecipeSlot) -> Result<bool, Error>
pub async fn has_ingredients(&mut self, slot: RecipeSlot) -> Result<bool, Error>
Returns whether all ingredients (both solid and fluid) required to craft the specified recipe are present in the assembler.
Errors
sourcepub async fn is_valid_recipe(&mut self, slot: RecipeSlot) -> Result<bool, Error>
pub async fn is_valid_recipe(&mut self, slot: RecipeSlot) -> Result<bool, Error>
Checks whether a recipe is properly configured.
A recipe is defined as being “properly configured” if it produces any kind of output.
Errors
sourcepub async fn max_energy_stored(&mut self) -> Result<u32, Error>
pub async fn max_energy_stored(&mut self) -> Result<u32, Error>
sourcepub async fn energy_stored(&mut self) -> Result<u32, Error>
pub async fn energy_stored(&mut self) -> Result<u32, Error>
sourcepub async fn stack_in_slot(
self,
slot: ItemStorageSlot
) -> Result<Option<ItemStack<'buffer>>, Error>
pub async fn stack_in_slot(
self,
slot: ItemStorageSlot
) -> Result<Option<ItemStack<'buffer>>, Error>
sourcepub async fn buffer_stack(
self,
slot: RecipeSlot
) -> Result<Option<ItemStack<'buffer>>, Error>
pub async fn buffer_stack(
self,
slot: RecipeSlot
) -> Result<Option<ItemStack<'buffer>>, Error>
sourcepub async fn enable_computer_control(
&mut self,
enable: bool
) -> Result<(), Error>
pub async fn enable_computer_control(
&mut self,
enable: bool
) -> Result<(), Error>
Enables or disables computer control of the assembler.
If enable is true, the assembler runs or stops each recipe based on the most recent
call to set_enabled. If enable is false, the assembler runs or stops
based on the redstone signal at the control port.
Whenever this function is called with enable set to true, whether or not the assembler
was previously under computer control, all recipes are enabled. It is necessary to
immediately call set_enabled to disable recipes if that is not desired.
Errors
sourcepub async fn set_enabled(
&mut self,
slot: RecipeSlot,
enable: bool
) -> Result<(), Error>
pub async fn set_enabled(
&mut self,
slot: RecipeSlot,
enable: bool
) -> Result<(), Error>
Enables or disables a recipe.
This should only be called if the assembler is under computer control via a preceding call
to enable_computer_control. If that is not the case, the call
will succeed but have no effect.
Errors
Auto Trait Implementations
impl<'invoker, 'buffer, B> RefUnwindSafe for Locked<'invoker, 'buffer, B> where
B: RefUnwindSafe,
impl<'invoker, 'buffer, B> Send for Locked<'invoker, 'buffer, B> where
B: Send,
impl<'invoker, 'buffer, B> Sync for Locked<'invoker, 'buffer, B> where
B: Sync,
impl<'invoker, 'buffer, B> Unpin for Locked<'invoker, 'buffer, B>
impl<'invoker, 'buffer, B> !UnwindSafe for Locked<'invoker, 'buffer, B>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more