pub struct Processor<'processor> {
pub storage: Option<Box<dyn RadStorage>>,
/* private fields */
}Expand description
Processor that parses(lexes) given input and print out to desginated output
Fields
storage: Option<Box<dyn RadStorage>>Implementations
sourceimpl<'processor> Processor<'processor>
impl<'processor> Processor<'processor>
sourcepub fn write_to_file(
self,
target_file: Option<impl AsRef<Path>>
) -> RadResult<Self>
pub fn write_to_file(
self,
target_file: Option<impl AsRef<Path>>
) -> RadResult<Self>
Set write option to yield output to the file
sourcepub fn write_to_variable(self, value: &'processor mut String) -> Self
pub fn write_to_variable(self, value: &'processor mut String) -> Self
Write to variable
sourcepub fn error_to_file(
self,
target_file: Option<impl AsRef<Path>>
) -> RadResult<Self>
pub fn error_to_file(
self,
target_file: Option<impl AsRef<Path>>
) -> RadResult<Self>
Yield error to the file
sourcepub fn error_to_variable(self, value: &'processor mut String) -> Self
pub fn error_to_variable(self, value: &'processor mut String) -> Self
Yield error to the file
sourcepub fn custom_comment_char(self, character: char) -> RadResult<Self>
pub fn custom_comment_char(self, character: char) -> RadResult<Self>
Custom comment character
sourcepub fn custom_macro_char(self, character: char) -> RadResult<Self>
pub fn custom_macro_char(self, character: char) -> RadResult<Self>
Custom macro character
sourcepub fn unix_new_line(self, use_unix_new_line: bool) -> Self
pub fn unix_new_line(self, use_unix_new_line: bool) -> Self
Use unix line ending instead of operating system’s default one
sourcepub fn pipe_truncate(self, truncate: bool) -> Self
pub fn pipe_truncate(self, truncate: bool) -> Self
Set truncate option
sourcepub fn set_comment_type(self, comment_type: CommentType) -> Self
pub fn set_comment_type(self, comment_type: CommentType) -> Self
Set comment type
sourcepub fn silent(self, silent_type: WarningType) -> Self
pub fn silent(self, silent_type: WarningType) -> Self
Set silent option
sourcepub fn melt_files(self, paths: Vec<impl AsRef<Path>>) -> RadResult<Self>
pub fn melt_files(self, paths: Vec<impl AsRef<Path>>) -> RadResult<Self>
Melt rule file
This always melt file into non-volatile form
sourcepub fn rule_literal(self, literal: &Vec<u8>) -> RadResult<Self>
pub fn rule_literal(self, literal: &Vec<u8>) -> RadResult<Self>
Melt rule as literal input source, or say from byte array
sourcepub fn allow_with_warning(self, auth_types: Option<Vec<AuthType>>) -> Self
pub fn allow_with_warning(self, auth_types: Option<Vec<AuthType>>) -> Self
Open authorization of processor but yield warning
sourcepub fn storage(self, storage: Box<dyn RadStorage>) -> Self
pub fn storage(self, storage: Box<dyn RadStorage>) -> Self
Build with storage
sourcepub fn insert_queue(&mut self, item: &str)
pub fn insert_queue(&mut self, item: &str)
Set queue object
sourcepub fn set_hygiene(&mut self, hygiene: Hygiene)
pub fn set_hygiene(&mut self, hygiene: Hygiene)
Set hygiene type
This also clears volatile runtime macro at the same time.
sourcepub fn clear_volatile(&mut self)
pub fn clear_volatile(&mut self)
Clear volatile macros
sourcepub fn toggle_hygiene(&mut self, toggle: bool)
pub fn toggle_hygiene(&mut self, toggle: bool)
Toggle macro hygiene
sourcepub fn set_write_option(&mut self, write_option: WriteOption<'processor>)
pub fn set_write_option(&mut self, write_option: WriteOption<'processor>)
Set write option in the process
sourcepub fn enable_cache(&mut self, truncate: bool) -> RadResult<()>
pub fn enable_cache(&mut self, truncate: bool) -> RadResult<()>
Toggle cache option
pub fn flush_cache(&mut self) -> RadResult<()>
sourcepub fn reset_flow_control(&mut self)
pub fn reset_flow_control(&mut self)
Set write option in the process
sourcepub fn print_permission(&mut self) -> RadResult<()>
pub fn print_permission(&mut self) -> RadResult<()>
Print current permission status
sourcepub fn print_result(&mut self) -> RadResult<()>
pub fn print_result(&mut self) -> RadResult<()>
Print the result of a processing
sourcepub fn organize_and_clear_cache(&mut self) -> RadResult<Option<String>>
pub fn organize_and_clear_cache(&mut self) -> RadResult<Option<String>>
Clear cached and organze multiple jobs
-
- clear volatile macors
-
- Check if there is any unterminated job Return cached string, if cache was not empty
sourcepub fn set_storage(&mut self, storage: Box<dyn RadStorage>)
pub fn set_storage(&mut self, storage: Box<dyn RadStorage>)
Set storage
sourcepub fn extract_storage(
&mut self,
serialize: bool
) -> RadResult<Option<StorageOutput>>
pub fn extract_storage(
&mut self,
serialize: bool
) -> RadResult<Option<StorageOutput>>
Extract from storage
sourcepub fn freeze_to_file(&self, path: impl AsRef<Path>) -> RadResult<()>
pub fn freeze_to_file(&self, path: impl AsRef<Path>) -> RadResult<()>
Freeze to a single file
Frozen file is a bincode encoded binary format file.
sourcepub fn add_ext_macro(&mut self, ext: ExtMacroBuilder)
pub fn add_ext_macro(&mut self, ext: ExtMacroBuilder)
Add a new macro as an extension
sourcepub fn add_runtime_rules(
&mut self,
rules: Vec<(impl AsRef<str>, &str, &str)>
) -> RadResult<()>
pub fn add_runtime_rules(
&mut self,
rules: Vec<(impl AsRef<str>, &str, &str)>
) -> RadResult<()>
sourcepub fn add_static_rules(
&mut self,
rules: Vec<(impl AsRef<str>, impl AsRef<str>)>
) -> RadResult<()>
pub fn add_static_rules(
&mut self,
rules: Vec<(impl AsRef<str>, impl AsRef<str>)>
) -> RadResult<()>
sourcepub fn from_stdin(&mut self) -> RadResult<Option<String>>
pub fn from_stdin(&mut self) -> RadResult<Option<String>>
Read from standard input
If debug mode is enabled this, doesn’t read stdin line by line but by chunk because user input is also a standard input and processor cannot distinguish the two
sourcepub fn from_file(&mut self, path: impl AsRef<Path>) -> RadResult<Option<String>>
pub fn from_file(&mut self, path: impl AsRef<Path>) -> RadResult<Option<String>>
Process contents from a file
pub fn set_documentation(&mut self, macro_name: &str, content: &str) -> bool
pub fn get_current_dir(&self) -> RadResult<PathBuf>
pub fn print_error(&mut self, error: &str) -> RadResult<()>
pub fn get_split_arguments(
&self,
target_length: usize,
source: &str
) -> RadResult<Vec<String>>
sourcepub fn check_auth(&mut self, auth_type: AuthType) -> RadResult<bool>
pub fn check_auth(&mut self, auth_type: AuthType) -> RadResult<bool>
Check auth information
This will print log_error if auth was enabled with warning
@return If auth is enabled or not
sourcepub fn expand(
&mut self,
level: usize,
source: impl AsRef<str>
) -> RadResult<String>
pub fn expand(
&mut self,
level: usize,
source: impl AsRef<str>
) -> RadResult<String>
Expand given text
sourcepub fn contains_macro(&self, macro_name: &str, macro_type: MacroType) -> bool
pub fn contains_macro(&self, macro_name: &str, macro_type: MacroType) -> bool
Check if given macro exists
sourcepub fn undefine_macro(&mut self, macro_name: &str, macro_type: MacroType)
pub fn undefine_macro(&mut self, macro_name: &str, macro_type: MacroType)
Try undefine macro
sourcepub fn rename_macro(
&mut self,
macro_name: &str,
target_name: &str,
macro_type: MacroType
)
pub fn rename_macro(
&mut self,
macro_name: &str,
target_name: &str,
macro_type: MacroType
)
Rename macro
sourcepub fn append_macro(&mut self, macro_name: &str, target: &str)
pub fn append_macro(&mut self, macro_name: &str, target: &str)
Append content into a macro
sourcepub fn replace_macro(&mut self, macro_name: &str, target: &str) -> bool
pub fn replace_macro(&mut self, macro_name: &str, target: &str) -> bool
Replace macro’s content
sourcepub fn add_new_local_macro(
&mut self,
level: usize,
macro_name: &str,
body: &str
)
pub fn add_new_local_macro(
&mut self,
level: usize,
macro_name: &str,
body: &str
)
Add new local macro
sourcepub fn remove_local_macro(&mut self, level: usize, macro_name: &str)
pub fn remove_local_macro(&mut self, level: usize, macro_name: &str)
Remove local macro
Auto Trait Implementations
impl<'processor> !RefUnwindSafe for Processor<'processor>
impl<'processor> !Send for Processor<'processor>
impl<'processor> !Sync for Processor<'processor>
impl<'processor> Unpin for Processor<'processor>
impl<'processor> !UnwindSafe for Processor<'processor>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more