Format code
This commit is contained in:
parent
294b84b490
commit
c5243c67b6
3 changed files with 24 additions and 19 deletions
|
@ -1,8 +1,8 @@
|
|||
use inflector::cases::pascalcase::to_pascal_case;
|
||||
use lazy_static::lazy_static;
|
||||
use proc_macro2::{Ident, TokenStream};
|
||||
use quote::{format_ident, ToTokens};
|
||||
use quote::quote;
|
||||
use quote::{format_ident, ToTokens};
|
||||
use regex::Regex;
|
||||
use std::collections::HashMap;
|
||||
use std::error::Error;
|
||||
|
|
|
@ -12,7 +12,9 @@ fn main() {
|
|||
let vendor_src = vendor.join("lvgl").join("src");
|
||||
|
||||
let lv_config_dir = {
|
||||
let conf_path = env::var(CONFIG_NAME).map(|raw_path| PathBuf::from(raw_path)).unwrap_or_else(|_| {
|
||||
let conf_path = env::var(CONFIG_NAME)
|
||||
.map(|raw_path| PathBuf::from(raw_path))
|
||||
.unwrap_or_else(|_| {
|
||||
match std::env::var("DOCS_RS") {
|
||||
Ok(_) => {
|
||||
// We've detected that we are building for docs.rs
|
||||
|
@ -22,9 +24,9 @@ fn main() {
|
|||
Err(_) => panic!(
|
||||
"The environment variable {} is required to be defined",
|
||||
CONFIG_NAME
|
||||
)
|
||||
}
|
||||
});
|
||||
),
|
||||
}
|
||||
});
|
||||
|
||||
if !conf_path.exists() {
|
||||
panic!(format!(
|
||||
|
@ -91,11 +93,20 @@ fn main() {
|
|||
if target.ends_with("emscripten") {
|
||||
if let Ok(em_path) = env::var("EMSDK") {
|
||||
additional_args.push("-I".to_string());
|
||||
additional_args.push(format!("{}/upstream/emscripten/system/include/libc", em_path));
|
||||
additional_args.push(format!(
|
||||
"{}/upstream/emscripten/system/include/libc",
|
||||
em_path
|
||||
));
|
||||
additional_args.push("-I".to_string());
|
||||
additional_args.push(format!("{}/upstream/emscripten/system/lib/libc/musl/arch/emscripten", em_path));
|
||||
additional_args.push(format!(
|
||||
"{}/upstream/emscripten/system/lib/libc/musl/arch/emscripten",
|
||||
em_path
|
||||
));
|
||||
additional_args.push("-I".to_string());
|
||||
additional_args.push(format!("{}/upstream/emscripten/system/include/SDL", em_path));
|
||||
additional_args.push(format!(
|
||||
"{}/upstream/emscripten/system/include/SDL",
|
||||
em_path
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +123,8 @@ fn main() {
|
|||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
bindings.write_to_file(out_path.join("bindings.rs"))
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Can't write bindings!");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,21 +29,15 @@ impl Color {
|
|||
}
|
||||
|
||||
pub fn r(&self) -> u8 {
|
||||
unsafe {
|
||||
lvgl_sys::_LV_COLOR_GET_R(self.raw) as u8
|
||||
}
|
||||
unsafe { lvgl_sys::_LV_COLOR_GET_R(self.raw) as u8 }
|
||||
}
|
||||
|
||||
pub fn g(&self) -> u8 {
|
||||
unsafe {
|
||||
lvgl_sys::_LV_COLOR_GET_G(self.raw) as u8
|
||||
}
|
||||
unsafe { lvgl_sys::_LV_COLOR_GET_G(self.raw) as u8 }
|
||||
}
|
||||
|
||||
pub fn b(&self) -> u8 {
|
||||
unsafe {
|
||||
lvgl_sys::_LV_COLOR_GET_B(self.raw) as u8
|
||||
}
|
||||
unsafe { lvgl_sys::_LV_COLOR_GET_B(self.raw) as u8 }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +244,6 @@ impl From<Animation> for lvgl_sys::lv_anim_enable_t {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
|
Loading…
Reference in a new issue