pub struct Configuration { /* private fields */ }Expand description
The configuration of the Topiary.
Contains information on how to format every language the user is interested in, modulo what is
supported. It can be provided by the user of the library, or alternatively, Topiary ships with
default configuration that can be accessed using Configuration::default.
Implementations§
Source§impl Configuration
impl Configuration
Sourcepub fn fetch(
merge: bool,
file: &Option<PathBuf>,
) -> TopiaryConfigResult<(Self, RichTerm)>
pub fn fetch( merge: bool, file: &Option<PathBuf>, ) -> TopiaryConfigResult<(Self, RichTerm)>
Consume the configuration from the usual sources.
Which sources exactly can be read in the documentation of Source.
§Errors
If the configuration file does not exist, this function will return a TopiaryConfigError
with the path that was not found.
If the configuration file exists, but cannot be parsed, this function will return a
TopiaryConfigError with the error that occurred.
Sourcepub fn get_language<T>(&self, name: T) -> TopiaryConfigResult<&Language>
pub fn get_language<T>(&self, name: T) -> TopiaryConfigResult<&Language>
Gets a language configuration from the entire configuration.
§Errors
If the provided language name cannot be found in the Configuration, this
function returns a TopiaryConfigError
Sourcepub fn prefetch_language<T>(
&self,
language: T,
force: bool,
) -> TopiaryConfigResult<()>
pub fn prefetch_language<T>( &self, language: T, force: bool, ) -> TopiaryConfigResult<()>
Prefetches and builds the desired language. This can be beneficial to speed up future startup time.
§Errors
If the language could not be found or the Grammar could not be build, a TopiaryConfigError is returned.
Sourcepub fn prefetch_languages(&self, force: bool) -> TopiaryConfigResult<()>
pub fn prefetch_languages(&self, force: bool) -> TopiaryConfigResult<()>
Prefetches and builds all known languages. This can be beneficial to speed up future startup time.
§Errors
If any Grammar could not be build, a TopiaryConfigError is returned.
Trait Implementations§
Source§impl Debug for Configuration
impl Debug for Configuration
Source§impl From<&Configuration> for HashMap<String, Language>
Convert Serialisation values into HashMaps, keyed on Language::name
impl From<&Configuration> for HashMap<String, Language>
Convert Serialisation values into HashMaps, keyed on Language::name
Source§fn from(config: &Configuration) -> Self
fn from(config: &Configuration) -> Self
Source§impl PartialEq for Configuration
impl PartialEq for Configuration
Auto Trait Implementations§
impl Freeze for Configuration
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnwindSafe for Configuration
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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