rust: Create a root file for modules

The new `lib.rs` file is created to refer to all modules written in Rust. This way, only one `rustc` call is needed to compile an arbitrary amount of modules. It also converges with the way crates are structured.
This commit is contained in:
Dorota Czaplejewicz
2019-07-31 09:37:09 +00:00
parent d5f8b0d83b
commit 8326bd7016
3 changed files with 8 additions and 6 deletions

View File

@ -1,11 +1,10 @@
#[macro_use]
mod bitflags;
use std::boxed::Box; use std::boxed::Box;
use std::ffi::CString; use std::ffi::CString;
use std::num::Wrapping; use std::num::Wrapping;
use std::string::String; use std::string::String;
use super::bitflags;
/// Gathers stuff defined in C or called by C /// Gathers stuff defined in C or called by C
pub mod c { pub mod c {
use super::*; use super::*;
@ -221,7 +220,7 @@ pub enum ContentPurpose {
impl ContentPurpose { impl ContentPurpose {
fn from_num(num: u32) -> Option<ContentPurpose> { fn from_num(num: u32) -> Option<ContentPurpose> {
use ContentPurpose::*; use self::ContentPurpose::*;
match num { match num {
0 => Some(Normal), 0 => Some(Normal),
1 => Some(Alpha), 1 => Some(Alpha),
@ -241,7 +240,7 @@ impl ContentPurpose {
} }
} }
fn as_num(self: &ContentPurpose) -> u32 { fn as_num(self: &ContentPurpose) -> u32 {
use ContentPurpose::*; use self::ContentPurpose::*;
match self { match self {
Normal => 0, Normal => 0,
Alpha => 1, Alpha => 1,

3
src/lib.rs Normal file
View File

@ -0,0 +1,3 @@
#[macro_use]
mod bitflags;
mod imservice;

View File

@ -69,7 +69,7 @@ deps = [
# Replacement for eekboard-server # Replacement for eekboard-server
rslib = static_library( rslib = static_library(
'rslib', 'rslib',
sources: ['imservice.rs'], sources: ['lib.rs'],
rust_crate_type: 'staticlib' rust_crate_type: 'staticlib'
) )