Skip to main content

Component

Trait Component 

Source
pub trait Component: Sized {
    const KIND: &'static str;

    // Required methods
    fn from_address(address: Address) -> Self;
    fn address(&self) -> &Address;

    // Provided methods
    fn first() -> Option<Self> { ... }
    fn all() -> Vec<Self> { ... }
    fn at(address: impl Into<Address>) -> Option<Self> { ... }
    fn invoke(&self, method: &str, args: Vec<Value>) -> Result<Vec<Value>> { ... }
    fn invoke_async(&self, method: &str, args: Vec<Value>) -> Call ⓘ { ... }
}
Expand description

A typed component wrapper.

Required Associated Constants§

Source

const KIND: &'static str

The OpenComputers component type, such as "gpu".

Required Methods§

Source

fn from_address(address: Address) -> Self

Wraps an address without checking what is there.

Source

fn address(&self) -> &Address

Provided Methods§

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Component for Assembler

Source§

const KIND: &'static str = "assembler"

Source§

impl Component for BarcodeReader

Source§

const KIND: &'static str = "barcode_reader"

Source§

impl Component for Beacon

Source§

const KIND: &'static str = "beacon"

Source§

impl Component for BrewingStand

Source§

const KIND: &'static str = "brewing_stand"

Source§

impl Component for Chunkloader

Source§

const KIND: &'static str = "chunkloader"

Source§

impl Component for CommandBlock

Source§

const KIND: &'static str = "command_block"

Source§

impl Component for Comparator

Source§

const KIND: &'static str = "comparator"

Source§

impl Component for Computer

Source§

const KIND: &'static str = "computer"

Source§

impl Component for Crafting

Source§

const KIND: &'static str = "crafting"

Source§

impl Component for Data

Source§

const KIND: &'static str = "data"

Source§

impl Component for Database

Source§

const KIND: &'static str = "database"

Source§

impl Component for Debug

Source§

const KIND: &'static str = "debug"

Source§

impl Component for DiskDrive

Source§

const KIND: &'static str = "disk_drive"

Source§

impl Component for Drive

Source§

const KIND: &'static str = "drive"

Source§

impl Component for Drone

Source§

const KIND: &'static str = "drone"

Source§

impl Component for Eeprom

Source§

const KIND: &'static str = "eeprom"

Source§

impl Component for EnergyDevice

Source§

const KIND: &'static str = "energy_device"

Source§

impl Component for Experience

Source§

const KIND: &'static str = "experience"

Source§

impl Component for Filesystem

Source§

const KIND: &'static str = "filesystem"

Source§

impl Component for FluidHandler

Source§

const KIND: &'static str = "fluid_handler"

Source§

impl Component for FluidTank

Source§

const KIND: &'static str = "fluid_tank"

Source§

impl Component for Furnace

Source§

const KIND: &'static str = "furnace"

Source§

impl Component for Generator

Source§

const KIND: &'static str = "generator"

Source§

impl Component for Geolyzer

Source§

const KIND: &'static str = "geolyzer"

Source§

impl Component for Gpu

Source§

const KIND: &'static str = "gpu"

Source§

impl Component for Hologram

Source§

const KIND: &'static str = "hologram"

Source§

impl Component for Internet

Source§

const KIND: &'static str = "internet"

Source§

impl Component for Inventory

Source§

const KIND: &'static str = "inventory"

Source§

impl Component for InventoryController

Source§

const KIND: &'static str = "inventory_controller"

Source§

impl Component for Jukebox

Source§

const KIND: &'static str = "jukebox"

Source§

impl Component for Keyboard

Source§

const KIND: &'static str = "keyboard"

Source§

impl Component for Leash

Source§

const KIND: &'static str = "leash"

Source§

impl Component for Microcontroller

Source§

const KIND: &'static str = "microcontroller"

Source§

impl Component for MobSpawner

Source§

const KIND: &'static str = "mob_spawner"

Source§

impl Component for Modem

Source§

const KIND: &'static str = "modem"

Source§

impl Component for MotionSensor

Source§

const KIND: &'static str = "motion_sensor"

Source§

impl Component for Navigation

Source§

const KIND: &'static str = "navigation"

Source§

impl Component for NetSplitter

Source§

const KIND: &'static str = "net_splitter"

Source§

impl Component for NoteBlock

Source§

const KIND: &'static str = "note_block"

Source§

impl Component for Piston

Source§

const KIND: &'static str = "piston"

Source§

impl Component for Printer3d

Source§

const KIND: &'static str = "printer3d"

Source§

impl Component for Redstone

Source§

const KIND: &'static str = "redstone"

Source§

impl Component for Relay

Source§

const KIND: &'static str = "relay"

Source§

impl Component for Robot

Source§

const KIND: &'static str = "robot"

Source§

impl Component for Screen

Source§

const KIND: &'static str = "screen"

Source§

impl Component for Sign

Source§

const KIND: &'static str = "sign"

Source§

impl Component for Tablet

Source§

const KIND: &'static str = "tablet"

Source§

impl Component for TankController

Source§

const KIND: &'static str = "tank_controller"

Source§

impl Component for TractorBeam

Source§

const KIND: &'static str = "tractor_beam"

Source§

impl Component for Trading

Source§

const KIND: &'static str = "trading"

Source§

impl Component for Transposer

Source§

const KIND: &'static str = "transposer"

Source§

impl Component for Tunnel

Source§

const KIND: &'static str = "tunnel"

Source§

impl Component for Waypoint

Source§

const KIND: &'static str = "waypoint"