pub struct Tunnel(pub Address);Expand description
The tunnel component (5 methods).
Provided by OpenComputers’ LinkedCard.
Tuple Fields§
§0: AddressImplementations§
Source§impl Tunnel
impl Tunnel
Sourcepub fn get_channel(&self) -> Result<OcString>
pub fn get_channel(&self) -> Result<OcString>
Gets this link card’s shared channel address
Lua: tunnel.getChannel():string
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_channel_async(&self) -> Result<OcString>
pub async fn get_channel_async(&self) -> Result<OcString>
Self::get_channel without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn get_wake_message(&self) -> Result<(OcString, bool)>
pub fn get_wake_message(&self) -> Result<(OcString, bool)>
Get the current wake-up message.
Lua: tunnel.getWakeMessage():string, boolean
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn get_wake_message_async(&self) -> Result<(OcString, bool)>
pub async fn get_wake_message_async(&self) -> Result<(OcString, bool)>
Self::get_wake_message without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn max_packet_size(&self) -> Result<Number>
pub fn max_packet_size(&self) -> Result<Number>
Gets the maximum packet size (config setting).
Lua: tunnel.maxPacketSize():number
Direct call (runs immediately, drawing on the per-tick budget).
Sourcepub async fn max_packet_size_async(&self) -> Result<Number>
pub async fn max_packet_size_async(&self) -> Result<Number>
Self::max_packet_size without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn send(&self, data: &[Value]) -> Result<()>
pub fn send(&self, data: &[Value]) -> Result<()>
Sends the specified data to the card this one is linked to.
Lua: tunnel.send(data...)
Indirect call: waits for the next server tick.
Sourcepub async fn send_async(&self, data: &[Value]) -> Result<()>
pub async fn send_async(&self, data: &[Value]) -> Result<()>
Self::send without blocking: the call is queued, and
the program keeps running until the result comes back; see crate::task.
Sourcepub fn set_wake_message(
&self,
message: impl AsRef<[u8]>,
fuzzy: Option<bool>,
) -> Result<OcString>
pub fn set_wake_message( &self, message: impl AsRef<[u8]>, fuzzy: Option<bool>, ) -> Result<OcString>
Set the wake-up message and whether to ignore additional data/parameters.
Lua: tunnel.setWakeMessage(message:string[, fuzzy:boolean]):string
Indirect call: waits for the next server tick.
Sourcepub async fn set_wake_message_async(
&self,
message: impl AsRef<[u8]>,
fuzzy: Option<bool>,
) -> Result<OcString>
pub async fn set_wake_message_async( &self, message: impl AsRef<[u8]>, fuzzy: Option<bool>, ) -> Result<OcString>
Self::set_wake_message 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 Tunnel
impl Component for Tunnel
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.