pub struct Environment { /* private fields */ }Expand description
Contains state and host platform interfaces shared by all MeTTa runners. This includes config settings and logger
Generally there will be only one environment object needed, and it can be accessed by calling the Self::common_env method
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn common_env() -> &'static Self
pub fn common_env() -> &'static Self
Returns a reference to the shared common Environment
Sourcepub fn config_dir(&self) -> Option<&Path>
pub fn config_dir(&self) -> Option<&Path>
Returns the Path to the config dir, in an OS-specific location
Sourcepub fn caches_dir(&self) -> Option<&Path>
pub fn caches_dir(&self) -> Option<&Path>
Returns the Path to a directory where the MeTTa runner can put persistent caches
NOTE: The default location of the caches_dir dir is within cfg_dir, but if may be
overridden with EnvBuilder::set_caches_dir.
Sourcepub fn working_dir(&self) -> Option<&Path>
pub fn working_dir(&self) -> Option<&Path>
Returns the Path to the environment’s working_dir
NOTE: The Environment’s working_dir is not the same as the process working directory, and changing the process’s working directory will not affect the environment
Sourcepub fn initialization_metta_file_path(&self) -> Option<&Path>
pub fn initialization_metta_file_path(&self) -> Option<&Path>
Returns the path to the init.metta file, that is run to initialize a MeTTa runner and customize the MeTTa environment
Sourcepub fn catalogs(&self) -> impl Iterator<Item = &dyn ModuleCatalog> + '_
pub fn catalogs(&self) -> impl Iterator<Item = &dyn ModuleCatalog> + '_
Returns the ModuleCatalogs from the Environment, in search priority order
Sourcepub fn fs_mod_formats(&self) -> impl Iterator<Item = &dyn FsModuleFormat> + '_
pub fn fs_mod_formats(&self) -> impl Iterator<Item = &dyn FsModuleFormat> + '_
Returns the FsModuleFormats from the Environment, in priority order
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Environment
impl !RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl !UnwindSafe for Environment
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request