pub trait ContextState { }
Expand description
At trait setting up a state machine as described below.
Its implementors represent one specific state defining the amount and the
type of data the Context
type holds at that moment.
Implementors§
impl ContextState for HasSettings
The Context
has the following initialized and valid fields: path
,
dir_path
, root_path
and ct
. The context ct
contains data from
insert_config_vars()
and insert_settings()
.
Context<HasSettings>
has the following variables set:
TMPL_VAR_CURRENT_SCHEME
TMPL_VAR_DIR_PATH
in sync withself.dir_path
andTMPL_VAR_DOC_FILE_DATE
in sync withself.doc_file_date
(only if available).TMPL_VAR_EXTENSION_DEFAULT
TMPL_VAR_LANG
TMPL_VAR_PATH
in sync withself.path
,TMPL_VAR_ROOT_PATH
in sync withself.root_path
.TMPL_VAR_SCHEME_SYNC_DEFAULT
.TMPL_VAR_USERNAME
The variables are inserted by the following methods: self.from()
,
self.insert_config_vars()
and self.insert_settings()
.
Once this state is achieved, Context
is constant and write protected until
the next state transition.
State order | |
---|---|
Previous state | Invalid |
Current state | HasSettings |
Next state | ReadyForFilenameTemplate or HasExistingContent |
impl ContextState for Invalid
The Context
object is in an invalid state. Either it was not initialized
or its data does not correspond any more to the Content
it represents.
State order | |
---|---|
Previous state | none |
Current state | Invalid |
Next state | HasSettings |