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: SurfaceProjection
Implementations§
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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