mirror of
https://github.com/zellij-org/zellij.git
synced 2024-12-25 10:15:09 +03:00
No more glob imports in the register_tile! macro
This commit is contained in:
parent
4592f12349
commit
1275a9e73a
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "mosaic-tile"
|
name = "mosaic-tile"
|
||||||
version = "0.3.0"
|
version = "0.3.1"
|
||||||
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
|
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
description = "A small client-side library for writing mosaic plugins (tiles)"
|
description = "A small client-side library for writing mosaic plugins (tiles)"
|
||||||
|
@ -12,11 +12,8 @@ pub trait MosaicTile {
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! register_tile {
|
macro_rules! register_tile {
|
||||||
($t:ty) => {
|
($t:ty) => {
|
||||||
use mosaic_tile::*;
|
|
||||||
|
|
||||||
use std::cell::RefCell;
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static STATE: RefCell<$t> = RefCell::new(Default::default());
|
static STATE: std::cell::RefCell<$t> = std::cell::RefCell::new(Default::default());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -35,14 +32,14 @@ macro_rules! register_tile {
|
|||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn handle_key() {
|
pub fn handle_key() {
|
||||||
STATE.with(|state| {
|
STATE.with(|state| {
|
||||||
state.borrow_mut().handle_key(get_key());
|
state.borrow_mut().handle_key($crate::get_key());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn handle_global_key() {
|
pub fn handle_global_key() {
|
||||||
STATE.with(|state| {
|
STATE.with(|state| {
|
||||||
state.borrow_mut().handle_global_key(get_key());
|
state.borrow_mut().handle_global_key($crate::get_key());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user