lib: add a crate init function
This commit is contained in:
parent
5b80b10949
commit
7cce85709a
28
src/lib.rs
28
src/lib.rs
@ -45,3 +45,31 @@ pub use codec::threading;
|
||||
|
||||
#[cfg(feature = "device")]
|
||||
pub mod device;
|
||||
|
||||
fn init_error() {
|
||||
util::error::register_all();
|
||||
}
|
||||
|
||||
#[cfg(feature = "format")]
|
||||
fn init_format() {
|
||||
format::register_all();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "format"))]
|
||||
fn init_format() { }
|
||||
|
||||
#[cfg(feature = "device")]
|
||||
fn init_device() {
|
||||
device::register_all();
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "device"))]
|
||||
fn init_device() { }
|
||||
|
||||
pub fn init() -> Result<(), Error> {
|
||||
init_error();
|
||||
init_format();
|
||||
init_device();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user