1
0
Fork 0
forked from wry/wry

cli: add an input subcommand

This commit is contained in:
Julian Orth 2024-03-12 17:43:26 +01:00
parent 283e438d1b
commit efae1cd16a
19 changed files with 1383 additions and 36 deletions

View file

@ -148,11 +148,15 @@ impl XkbContext {
}))
}
pub fn keymap_from_str(&self, s: &str) -> Result<Rc<XkbKeymap>, XkbCommonError> {
pub fn keymap_from_str<S>(&self, s: &S) -> Result<Rc<XkbKeymap>, XkbCommonError>
where
S: AsRef<[u8]> + ?Sized,
{
let s = s.as_ref();
unsafe {
let keymap = xkb_keymap_new_from_buffer(
self.context,
s.as_bytes().as_ptr(),
s.as_ptr(),
s.len(),
XKB_KEYMAP_FORMAT_TEXT_V1.raw(),
0,