pub struct BaseConfig {
pub config_path: PathBuf,
pub database_path: PathBuf,
pub analysis_options: AnalysisOptions,
pub m: Array2<f32>,
}Expand description
The minimum configuration an application needs to work with a Library.
Fields§
§config_path: PathBufThe path to where the configuration file should be stored,
e.g. /home/foo/.local/share/bliss-rs/config.json
database_path: PathBufThe path to where the database file should be stored,
e.g. /home/foo/.local/share/bliss-rs/bliss.db
analysis_options: AnalysisOptionsThe analysis options set in the database (number of CPU cores for the analysis, desired feature version…)
m: Array2<f32>The mahalanobis matrix used for mahalanobis distance.
Used to customize the distance metric beyond simple euclidean distance.
Uses ndarray’s serde feature for serialization / deserialization.
Field would look like this:
“m”: {“v”: 1, “dim”: [20, 20], “data”: [1.0, 0.0, …, 1.0]}
Implementations§
Source§impl BaseConfig
impl BaseConfig
Sourcepub fn new(
config_path: Option<PathBuf>,
database_path: Option<PathBuf>,
analysis_options: Option<AnalysisOptions>,
) -> Result<Self>
pub fn new( config_path: Option<PathBuf>, database_path: Option<PathBuf>, analysis_options: Option<AnalysisOptions>, ) -> Result<Self>
Create a new, basic config. Upon calls of Config.write(), it will be
written to config_path.
Any path omitted will instead default to a “clever” path using
data directory inference. The “clever” thinking is as follows:
- If the user specified only one of the paths, it will put the other file in the same folder as the given path.
- If the user specified both paths, it will go with what the user chose.
- If the user didn’t select any path, it will try to put everything in the user’s configuration directory, i.e. XDG_CONFIG_HOME.
The number of cores is the number of cores that should be used for any analysis. If not provided, it will default to the computer’s number of cores.
Trait Implementations§
Source§impl AppConfigTrait for BaseConfig
impl AppConfigTrait for BaseConfig
Source§fn base_config(&self) -> &BaseConfig
fn base_config(&self) -> &BaseConfig
Config.Source§fn base_config_mut(&mut self) -> &mut BaseConfig
fn base_config_mut(&mut self) -> &mut BaseConfig
Config.Source§fn serialize_config(&self) -> Result<String>
fn serialize_config(&self) -> Result<String>
Source§fn set_number_cores(&mut self, number_cores: NonZeroUsize) -> Result<()>
fn set_number_cores(&mut self, number_cores: NonZeroUsize) -> Result<()>
Source§fn set_features_version(
&mut self,
features_version: FeaturesVersion,
) -> Result<()>
fn set_features_version( &mut self, features_version: FeaturesVersion, ) -> Result<()>
Source§fn get_features_version(&self) -> FeaturesVersion
fn get_features_version(&self) -> FeaturesVersion
Source§fn get_number_cores(&self) -> NonZeroUsize
fn get_number_cores(&self) -> NonZeroUsize
Source§fn deserialize_config(data: &str) -> Result<Self>
fn deserialize_config(data: &str) -> Result<Self>
Source§impl Clone for BaseConfig
impl Clone for BaseConfig
Source§fn clone(&self) -> BaseConfig
fn clone(&self) -> BaseConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BaseConfig
impl Debug for BaseConfig
Source§impl<'de> Deserialize<'de> for BaseConfig
impl<'de> Deserialize<'de> for BaseConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for BaseConfig
impl PartialEq for BaseConfig
Source§impl Serialize for BaseConfig
impl Serialize for BaseConfig
impl StructuralPartialEq for BaseConfig
Auto Trait Implementations§
impl Freeze for BaseConfig
impl RefUnwindSafe for BaseConfig
impl Send for BaseConfig
impl Sync for BaseConfig
impl Unpin for BaseConfig
impl UnwindSafe for BaseConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more