Skip to content

Commit 72a5087

Browse files
committed
Rust module API rework
1 parent 4071a5b commit 72a5087

File tree

12 files changed

+1012
-1105
lines changed

12 files changed

+1012
-1105
lines changed

crates/bindings-macro/src/lib.rs

Lines changed: 139 additions & 388 deletions
Large diffs are not rendered by default.

crates/bindings-macro/src/module.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::{check_duplicate, sym};
1212
pub(crate) struct SatsType<'a> {
1313
pub ident: &'a syn::Ident,
1414
pub generics: &'a syn::Generics,
15-
pub name: String,
15+
pub name: LitStr,
1616
pub krate: TokenStream,
1717
// may want to use in the future
1818
#[allow(unused)]
@@ -104,14 +104,14 @@ pub(crate) fn extract_sats_type<'a>(
104104
check_duplicate(&name, &meta)?;
105105
let value = meta.value()?;
106106
let v = value.parse::<LitStr>()?;
107-
name = Some(v.value());
107+
name = Some(v);
108108
}
109109
});
110110
Ok(())
111111
})?;
112112
}
113113
let krate = krate.unwrap_or(crate_fallback);
114-
let name = name.unwrap_or_else(|| ident.to_string());
114+
let name = name.unwrap_or_else(|| LitStr::new(&ident.to_string(), ident.span()));
115115

116116
Ok(SatsType {
117117
ident,

crates/bindings-sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@ pub struct Errno(NonZeroU16);
512512
// once Error gets exposed from core this crate can be no_std again
513513
impl std::error::Error for Errno {}
514514

515+
pub type Result<T, E = Errno> = core::result::Result<T, E>;
516+
515517
macro_rules! def_errno {
516518
($($err_name:ident($errno:literal, $errmsg:literal),)*) => {
517519
impl Errno {

crates/bindings/src/impls.rs

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)