pub use crate::log::LogLevel;
pub use crate::log::Logger;
pub use crate::mmkv::MMKV;
#[derive(Debug, PartialEq)]
pub enum Error {
KeyNotFound,
DecodeFailed(String),
TypeMissMatch,
DataInvalid,
InstanceClosed,
EncodeFailed(String),
IOError(String),
LockError(String),
#[cfg(feature = "encryption")]
DecryptFailed(String),
#[cfg(feature = "encryption")]
EncryptFailed(String),
}
pub type Result<T> = std::result::Result<T, Error>;
macro_rules! log {
($level:expr, $tag:expr, $($arg:tt)+) => {
crate::log::logger::log($level, $tag, format_args!($($arg)+))
}
}
macro_rules! error {
($tag:expr, $($arg:tt)+) => {
log!(crate::LogLevel::Error, $tag, $($arg)+)
}
}
#[allow(unused_macros)]
macro_rules! warn {
($tag:expr, $($arg:tt)+) => {
log!(crate::LogLevel::Warn, $tag, $($arg)+)
}
}
macro_rules! info {
($tag:expr, $($arg:tt)+) => {
log!(crate::LogLevel::Info, $tag, $($arg)+)
}
}
macro_rules! debug {
($tag:expr, $($arg:tt)+) => {
log!(crate::LogLevel::Debug, $tag, $($arg)+)
}
}
macro_rules! verbose {
($tag:expr, $($arg:tt)+) => {
log!(crate::LogLevel::Verbose, $tag, $($arg)+)
}
}
mod core;
#[cfg(not(target_os = "android"))]
#[cfg(not(feature = "encryption"))]
mod ffi;
#[cfg(target_os = "android")]
mod jni;
mod log;
mod mmkv;