Struct pytv::Config

source ·
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: String

The magic comment string used to identify template sections in the input file.

§template_re: Regex

The regular expression used to match template sections in the input file.

§run_python: bool

Whether to run the Python script or not.

§delete_python: bool

Whether to delete the Python script after running or not.

§tab_size: u32

The tab size used for parsing in the input file.

Implementations§

source§

impl Config

source

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);
source

pub fn from_args() -> (Config, FileOptions)

Parses the command line arguments and returns a tuple of Config and FileOptions.

Trait Implementations§

source§

impl Debug for Config

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

Creates a new Config instance with default values.

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.