[−][src]Struct test_data_generation::configs::Configs
Implementations
impl Configs[src]
pub fn new(path: &String) -> Configs[src]
Constructs a new Configs
Arguments
- `path: &String - The full path name (including the file name and extension) to the configuration file.
#Example
extern crate test_data_generation; use test_data_generation::configs::Configs; fn main() { // initalize a new Configs let mut cfg = Configs::new(&String::from("./tests/config/tdg.yaml")); cfg.load_config_file(); // verify the configuration file has been loaded println!("{:?}", cfg); }
pub fn from_serialized(serialized: &str) -> Configs[src]
Constructs a new Configs object from a serialized (JSON) string. This is used when restoring from "archive"
#Example
extern crate test_data_generation; use test_data_generation::configs::Configs; fn main() { let serialized = "{\"file\":\"./tests/config/tdg.yaml\"}"; let mut cfg = Configs::from_serialized(&serialized); assert_eq!(cfg.get_config_file_path(), "./tests/config/tdg.yaml"); }
pub fn get_config_file_path(&self) -> &str[src]
Loads the configuration file using the path that was provided during calling a new Configs object
#Example
extern crate test_data_generation; use test_data_generation::configs::Configs; fn main() { // initalize a new Configs let mut cfg = Configs::new(&String::from("./tests/config/tdg.yaml")); // verify the configuration file path was set println!("The configuration fiel is located at {}", cfg.get_config_file_path()); }
pub fn load_config_file(&mut self)[src]
Loads the configuration file using the path that was provided during calling a new Configs object
#Example
extern crate test_data_generation; use test_data_generation::configs::Configs; fn main() { // initalize a new Configs let mut cfg = Configs::new(&String::from("./tests/config/tdg.yaml")); cfg.load_config_file(); // verify the configuration file has been loaded println!("{:?}", cfg); }
pub fn serialize(&mut self) -> String[src]
This function converts the Configs object to a serialize JSON string.
#Example
extern crate test_data_generation; use test_data_generation::configs::Configs; fn main() { //create a Configs object from a configuration file let mut cfg = Configs::new(&String::from("./tests/config/tdg.yaml")); cfg.load_config_file(); println!("{}", cfg.serialize()); // {"key":"r","prior_key":null,"next_key":null,"pattern_placeholder":"c","starts_with":0,"ends_with":0,"index_offset":2} }
Trait Implementations
impl Debug for Configs[src]
impl<'de> Deserialize<'de> for Configs[src]
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>, [src]
__D: Deserializer<'de>,
impl Serialize for Configs[src]
Auto Trait Implementations
impl RefUnwindSafe for Configs
impl Send for Configs
impl Sync for Configs
impl Unpin for Configs
impl UnwindSafe for Configs
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> DebugAny for T where
T: Any + Debug,
T: Any + Debug,
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>, [src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> UnsafeAny for T where
T: Any,
T: Any,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,