pub struct Config {
pub system_dict: Option<PathBuf>,
pub user_dicts: Vec<PathBuf>,
pub character_definition_file: PathBuf,
pub connection_cost_plugins: Vec<Value>,
pub input_text_plugins: Vec<Value>,
pub oov_provider_plugins: Vec<Value>,
pub path_rewrite_plugins: Vec<Value>,
pub projection: SurfaceProjection,
/* private fields */
}Expand description
Setting data loaded from config file
Fields§
§system_dict: Option<PathBuf>§user_dicts: Vec<PathBuf>§character_definition_file: PathBuf§connection_cost_plugins: Vec<Value>§input_text_plugins: Vec<Value>§oov_provider_plugins: Vec<Value>§path_rewrite_plugins: Vec<Value>§projection: SurfaceProjectionImplementations§
Source§impl Config
impl Config
pub fn new( config_file: Option<PathBuf>, resource_dir: Option<PathBuf>, dictionary_path: Option<PathBuf>, ) -> Result<Self, ConfigError>
pub fn new_embedded() -> Result<Self, ConfigError>
Sourcepub fn minimal_at(resource_dir: impl Into<PathBuf>) -> Config
pub fn minimal_at(resource_dir: impl Into<PathBuf>) -> Config
Creates a minimal config with the provided resource directory
Sourcepub fn with_system_dic(self, system: impl Into<PathBuf>) -> Config
pub fn with_system_dic(self, system: impl Into<PathBuf>) -> Config
Sets the system dictionary to the provided path
pub fn resolve_paths(&self, path: String) -> Vec<String>
Sourcepub fn complete_path<P: AsRef<Path> + Into<PathBuf>>(
&self,
file_path: P,
) -> Result<PathBuf, ConfigError>
pub fn complete_path<P: AsRef<Path> + Into<PathBuf>>( &self, file_path: P, ) -> Result<PathBuf, ConfigError>
Resolves a possibly relative path with regards to all possible anchors:
- Absolute paths stay as they are
- Paths are resolved wrt to anchors, returning the first existing one
- Path are checked wrt to CWD
- If all fail, return an error with all candidate paths listed
pub fn resolved_system_dict(&self) -> Result<PathBuf, ConfigError>
pub fn resolved_user_dicts(&self) -> Result<Vec<PathBuf>, ConfigError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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