Skip to main content

PatternProvider

Struct PatternProvider 

Source
pub struct PatternProvider(pub Address);
Expand description

The pattern_provider component.

Tuple Fields§

§0: Address

Implementations§

Source§

impl PatternProvider

Source

pub fn set_patterns(&self, patterns: &[Pattern]) -> Result<usize>

Replaces every pattern. Returns how many there are.

Source

pub async fn set_patterns_async(&self, patterns: &[Pattern]) -> Result<usize>

Self::set_patterns without blocking; see crate::task.

Source

pub fn add_pattern(&self, pattern: &Pattern) -> Result<i64>

Adds a pattern. Returns its index (from 1).

Source

pub async fn add_pattern_async(&self, pattern: &Pattern) -> Result<i64>

Self::add_pattern without blocking; see crate::task.

Source

pub fn remove_pattern(&self, index: i64) -> Result<bool>

Removes the pattern at index (from 1); later ones move down. Jobs already handed over are kept. false if there was none.

Source

pub async fn remove_pattern_async(&self, index: i64) -> Result<bool>

Self::remove_pattern without blocking; see crate::task.

Source

pub fn patterns(&self) -> Result<Vec<Pattern>>

Every pattern, in order.

Source

pub async fn patterns_async(&self) -> Result<Vec<Pattern>>

Self::patterns without blocking; see crate::task.

Source

pub fn jobs(&self) -> Result<Vec<Job>>

The jobs waiting, oldest first.

Source

pub async fn jobs_async(&self) -> Result<Vec<Job>>

Self::jobs without blocking; see crate::task.

Source

pub fn job(&self, id: i64) -> Result<Option<Job>>

One job; None once it’s done or cancelled.

Source

pub async fn job_async(&self, id: i64) -> Result<Option<Job>>

Self::job without blocking; see crate::task.

Source

pub fn push_inputs(&self, id: i64, side: Side) -> Result<bool>

Moves a job’s inputs into the inventory or tank on side of the block. true once everything is out, which ends the job; false if some didn’t fit (it stays held, for another try).

Source

pub async fn push_inputs_async(&self, id: i64, side: Side) -> Result<bool>

Self::push_inputs without blocking; see crate::task.

Source

pub fn cancel_job(&self, id: i64) -> Result<bool>

Gives up on a job, returning its inputs to the ME network. true if they all went back, ending the job. AE2’s crafting job keeps waiting for its outputs until it’s cancelled in a terminal.

Source

pub async fn cancel_job_async(&self, id: i64) -> Result<bool>

Self::cancel_job without blocking; see crate::task.

Source

pub fn is_online(&self) -> Result<bool>

Whether the block is on a powered ME network with a channel.

Source

pub async fn is_online_async(&self) -> Result<bool>

Self::is_online without blocking; see crate::task.

Trait Implementations§

Source§

impl Clone for PatternProvider

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Component for PatternProvider

Source§

const KIND: &'static str = "pattern_provider"

The OpenComputers component type, such as "gpu".
Source§

fn from_address(address: Address) -> Self

Wraps an address without checking what is there.
Source§

fn address(&self) -> &Address

Source§

fn first() -> Option<Self>

The first component of this type, by address order.
Source§

fn all() -> Vec<Self>

Every component of this type, by address order.
Source§

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>>

An untyped call, for methods the wrapper doesn’t know.
Source§

fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ

Component::invoke without blocking; see invoke_async.
Source§

impl Debug for PatternProvider

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PatternProvider

Source§

impl Hash for PatternProvider

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for PatternProvider

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PatternProvider

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.