2021-10-05 14:24:08 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021 Lynnesbian
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
|
2021-09-24 14:53:35 +00:00
|
|
|
//! This library consists of all of the things fif needs to run. It only exists as a library to separate code, and to
|
2021-10-05 15:30:13 +00:00
|
|
|
//! make documentation and testing a bit easier. I don't recommend using this as a library for your crate, as it may
|
|
|
|
//! have breaking changes without incrementing the major version - it's really only meant to be a place for fif's
|
|
|
|
//! internals to live.
|
|
|
|
//!
|
|
|
|
//! You can view [fif's README](https://gitlab.com/Lynnesbian/fif/-/blob/master/README.md#fif) to learn more.
|
|
|
|
|
|
|
|
#![forbid(unsafe_code)]
|
2021-10-05 15:41:08 +00:00
|
|
|
#![warn(
|
|
|
|
trivial_casts,
|
|
|
|
unused_lifetimes,
|
|
|
|
unused_qualifications,
|
|
|
|
missing_copy_implementations,
|
|
|
|
unused_allocation
|
|
|
|
)]
|
2021-08-28 07:54:01 +00:00
|
|
|
|
2021-08-28 07:59:04 +00:00
|
|
|
pub mod files;
|
2021-08-28 07:54:01 +00:00
|
|
|
pub mod findings;
|
|
|
|
pub mod formats;
|
2021-08-28 07:59:04 +00:00
|
|
|
pub mod mime_db;
|
2021-08-28 07:54:01 +00:00
|
|
|
pub mod parameters;
|
|
|
|
pub mod utils;
|
|
|
|
|
2021-08-28 07:59:04 +00:00
|
|
|
use cfg_if::cfg_if;
|
2021-09-24 13:53:02 +00:00
|
|
|
use once_cell::sync::Lazy;
|
2021-08-28 07:54:01 +00:00
|
|
|
|
2021-09-24 08:11:25 +00:00
|
|
|
use crate::findings::Findings;
|
|
|
|
use crate::mime_db::MimeDb;
|
|
|
|
|
2021-08-28 08:00:31 +00:00
|
|
|
cfg_if! {
|
|
|
|
if #[cfg(not(all(target_endian = "big", target_pointer_width = "32")))] {
|
2021-10-05 15:30:13 +00:00
|
|
|
/// On most architectures, this is a type alias for [`SmartString`](crate). However, on [architectures
|
|
|
|
/// unsupported by `smartstring`](https://github.com/bodil/smartstring/blob/v0.2.9/src/config.rs#L91-L93), this
|
|
|
|
/// is simply an alias to [`std::string::String`].
|
2021-08-28 08:00:31 +00:00
|
|
|
pub use smartstring::alias::String;
|
|
|
|
} else {
|
2021-10-05 15:30:13 +00:00
|
|
|
/// On most architectures, this is a type alias for [`SmartString`](crate). However, on [architectures
|
|
|
|
/// unsupported by `smartstring`](https://github.com/bodil/smartstring/blob/v0.2.9/src/config.rs#L91-L93), this
|
|
|
|
/// is simply an alias to [`std::string::String`].
|
|
|
|
// one particular arch that this needs to be turned off for is powerpc (the 32 bit variant that the pre-G5
|
|
|
|
// powerpc macs used)
|
2021-08-28 08:00:31 +00:00
|
|
|
pub use std::string::String;
|
|
|
|
}
|
|
|
|
}
|
2021-08-28 07:54:01 +00:00
|
|
|
cfg_if! {
|
|
|
|
if #[cfg(any(all(unix, feature = "infer-backend"), all(not(unix), not(feature = "xdg-mime-backend"))))] {
|
2021-10-05 15:30:13 +00:00
|
|
|
/// A [`Lazy`] holding an instance of [`mime_db::MimeDb`]. Initialised at program startup.
|
2021-09-24 14:53:35 +00:00
|
|
|
pub static MIMEDB: Lazy<mime_db::InferDb> = Lazy::new(crate::mime_db::InferDb::init);
|
2021-08-28 07:54:01 +00:00
|
|
|
} else {
|
2021-10-05 15:30:13 +00:00
|
|
|
/// A [`Lazy`] holding an instance of [`mime_db::MimeDb`]. Initialised at program startup.
|
2021-09-24 14:53:35 +00:00
|
|
|
pub static MIMEDB: Lazy<mime_db::XdgDb> = Lazy::new(crate::mime_db::XdgDb::init);
|
2021-08-28 07:54:01 +00:00
|
|
|
}
|
2021-08-28 07:59:04 +00:00
|
|
|
}
|