Use &str instead of String for protocol names
This commit is contained in:
parent
7c738c24ec
commit
cedd5503e6
|
@ -48,7 +48,7 @@ pub trait Instance {
|
|||
/// userdata. Then, when the runtime calls back into the script, the
|
||||
/// userdata will be reinterpreted as a pointer and a method can be called
|
||||
/// on that object in memory.
|
||||
fn bind_panel(&self, panel: PanelId, protocol: String, msg: Vec<u8>) -> u32;
|
||||
fn bind_panel(&self, panel: PanelId, protocol: &str, msg: Vec<u8>) -> u32;
|
||||
|
||||
fn update(&self, panel_ud: u32, dt: f32);
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ impl WasmtimeInstance {
|
|||
}
|
||||
|
||||
impl Instance for WasmtimeInstance {
|
||||
fn bind_panel(&self, panel: PanelId, protocol: String, msg: Vec<u8>) -> u32 {
|
||||
fn bind_panel(&self, panel: PanelId, protocol: &str, msg: Vec<u8>) -> u32 {
|
||||
let mut store = self.store.lock();
|
||||
let protocol = store.data().message_new(protocol.as_bytes().to_vec());
|
||||
let msg = store.data().message_new(msg);
|
||||
|
|
|
@ -45,7 +45,7 @@ pub struct Script {
|
|||
}
|
||||
|
||||
impl Script {
|
||||
pub fn create_panel(&mut self, protocol: String, msg: Vec<u8>) -> anyhow::Result<Panel> {
|
||||
pub fn create_panel(&mut self, protocol: &str, msg: Vec<u8>) -> anyhow::Result<Panel> {
|
||||
let id = PanelId(self.next_panel);
|
||||
self.next_panel += 1;
|
||||
let userdata = self.instance.bind_panel(id, protocol, msg);
|
||||
|
|
Loading…
Reference in New Issue