pub struct Config {
pub magic_comment_str: String,
pub template_re: Regex,
pub run_python: bool,
pub delete_python: bool,
pub tab_size: u32,
}Expand description
Represents the configuration options for PyTV.
Fields§
§magic_comment_str: StringThe magic comment string used to identify template sections in the input file.
template_re: RegexThe regular expression used to match template sections in the input file.
run_python: boolWhether to run the Python script or not.
delete_python: boolWhether to delete the Python script after running or not.
tab_size: u32The tab size used for parsing in the input file.
Implementations§
source§impl Config
impl Config
sourcepub fn new(
magic_comment_str: String,
template_re: Regex,
run_python: bool,
delete_python: bool,
tab_size: u32
) -> Config
pub fn new( magic_comment_str: String, template_re: Regex, run_python: bool, delete_python: bool, tab_size: u32 ) -> Config
Creates a new Config instance with the specified values.
§Example
use pytv::Config;
use regex::Regex;
let config = Config::new("!".to_string(), Regex::new(r"`([^`]+)`").unwrap(), false, false, 4);
let default_config = Config::default();
assert_eq!(config.magic_comment_str, default_config.magic_comment_str);sourcepub fn from_args() -> (Config, FileOptions)
pub fn from_args() -> (Config, FileOptions)
Parses the command line arguments and returns a tuple of Config and FileOptions.
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