pub struct CryptConfig { /* private fields */ }Expand description
A Crypt Configuration object
Uses a simple map for string identifiers to CryptObjects. Configs can contain other nested configs, string literals, and identifiers. String literals and identifiers are both stored as a String.
§Example
Example crypt file:
./tests/test.crypt
version = "0.1.0";
name = "Test";
type = "Executable"Opening the file:
use crypt_configs::{open_config, body::CryptObject};
let config = match open_config("tests/test.crypt") {
Ok(c) => c,
Err(e) => panic!("Failed to open test file!"),
};
assert_eq!(config.get("version").unwrap().try_into(), Ok(&String::from("0.1.0")));
assert_eq!(config.get("name").unwrap().try_into(), Ok(&String::from("Test")));
assert_eq!(config.get("type").unwrap().try_into(), Ok(&String::from("Executable")));Implementations§
Source§impl CryptConfig
impl CryptConfig
Sourcepub fn get<S>(&self, ident: S) -> Option<&CryptObject>
pub fn get<S>(&self, ident: S) -> Option<&CryptObject>
Retrieves an item from the config
The object is ambiguously wrapped in a CryptObject.
Trait Implementations§
Source§impl Debug for CryptConfig
impl Debug for CryptConfig
impl Eq for CryptConfig
Source§impl PartialEq for CryptConfig
impl PartialEq for CryptConfig
Source§fn eq(&self, other: &CryptConfig) -> bool
fn eq(&self, other: &CryptConfig) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CryptConfig
Source§impl<'a> TryInto<&'a CryptConfig> for &'a CryptObject
impl<'a> TryInto<&'a CryptConfig> for &'a CryptObject
Source§type Error = CryptConversionError
type Error = CryptConversionError
The type returned in the event of a conversion error.
Auto Trait Implementations§
impl Freeze for CryptConfig
impl RefUnwindSafe for CryptConfig
impl Send for CryptConfig
impl Sync for CryptConfig
impl Unpin for CryptConfig
impl UnsafeUnpin for CryptConfig
impl UnwindSafe for CryptConfig
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