aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-07-07 13:08:53 +0900
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>2022-07-07 13:08:53 +0900
commit89077649690633fc8985af39979e69fe4daaaad0 (patch)
tree0e1f9dd8fae5fae55fdad7a66986b51e4142a061
parent5d868964905c55ec661ef95018e8b70274085d6a (diff)
downloadhinawa-rs-89077649690633fc8985af39979e69fe4daaaad0.tar.gz
hinawa: add prelude module to import all of traits and their implementations
In the fashion of glib crate, public prelude module in top level is used to import traits and their implementations in user application, while public use declaration is used to import structures, enumerations, flags, and functions. This commit follows to the fashion. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
-rw-r--r--hinawa/examples/read-quadlet.rs2
-rw-r--r--hinawa/src/lib.rs11
2 files changed, 11 insertions, 2 deletions
diff --git a/hinawa/examples/read-quadlet.rs b/hinawa/examples/read-quadlet.rs
index 7a044aa..0356bcc 100644
--- a/hinawa/examples/read-quadlet.rs
+++ b/hinawa/examples/read-quadlet.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT
use glib::*;
-use hinawa::{traits::*, *};
+use hinawa::{prelude::*, *};
const PATH: &str = "/dev/fw1";
const OFFSET: u64 = 0xfffff0000404;
diff --git a/hinawa/src/lib.rs b/hinawa/src/lib.rs
index 1f93ca9..6f31167 100644
--- a/hinawa/src/lib.rs
+++ b/hinawa/src/lib.rs
@@ -5,9 +5,18 @@ mod fw_node;
mod fw_req;
mod fw_resp;
+// For convenience to provide structures and functions.
+pub use crate::auto::*;
+
+/// For convenience to provide auto-generated/manual traits, and their blanket implementations.
+pub mod prelude {
+ pub use crate::{auto::traits::*, fw_fcp::*, fw_node::*, fw_req::*, fw_resp::*};
+}
+
+/// For subclass implementations derived from provided class.
pub mod subclass;
-pub use crate::{auto::*, fw_node::*, fw_req::*, fw_resp::*};
+// To access to hinawa-sys crate for FFI.
pub use ffi;
use glib::{signal::*, translate::*, Cast, IsA, SignalHandlerId};