[−][src]Struct preftool::ConfigKey
Represents a configuration key. Configuration keys are case-insensitive, and all instances are lower-cased.
Methods
impl ConfigKey
[src]
pub fn empty() -> Self
[src]
Get an empty config key.
pub fn is_empty(&self) -> bool
[src]
pub fn len(&self) -> usize
[src]
Key length.
pub fn separator() -> &'static str
[src]
Configuration key seperator.
pub fn section_key(&self) -> Self
[src]
Get the section key given a config path.
Arguments
path
- configuration path.
Example
use preftool::ConfigKey; assert_eq!(ConfigKey::from("").section_key(), ""); assert_eq!(ConfigKey::from("foo").section_key(), "foo"); assert_eq!(ConfigKey::from("foo:bar").section_key(), "bar"); assert_eq!(ConfigKey::from("foo:bar:baz").section_key(), "baz");
pub fn parent(&self) -> Self
[src]
Get the parent config path.
Arguments
path
- configuration path.
Example
use preftool::ConfigKey; assert_eq!(ConfigKey::from("").parent(), ""); assert_eq!(ConfigKey::from("foo").parent(), ""); assert_eq!(ConfigKey::from("foo:bar").parent(), "foo"); assert_eq!(ConfigKey::from("foo:bar:baz").parent(), "foo:bar");
pub fn combine<S2: Into<ConfigKey>>(&self, key: S2) -> Self
[src]
Combine two config path segments.
Arguments
path
- configuration path.key
- configuration sub-key.
Example
use preftool::ConfigKey; assert_eq!(ConfigKey::from("").combine(""), ""); assert_eq!(ConfigKey::from("").combine("foo"), "foo"); assert_eq!(ConfigKey::from("foo:bar").combine("baz"), "foo:bar:baz"); assert_eq!(ConfigKey::from("foo").combine("bar:baz"), "foo:bar:baz");
pub fn join<S: Into<ConfigKey>, I: IntoIterator<Item = S>>(parts: I) -> Self
[src]
Join a list of path segments into one config path.
Arguments
paths
- configuration path segments.
Example
use preftool::ConfigKey; assert_eq!(ConfigKey::join::<&'static str, Vec<_>>(vec!()), ""); assert_eq!(ConfigKey::join(vec!("foo")), "foo"); assert_eq!(ConfigKey::join(vec!("", "foo", "")), "foo"); assert_eq!(ConfigKey::join(vec!("", "foo:bar", "", "baz")), "foo:bar:baz");
pub fn unsafe_from<S: Into<String>>(value: S) -> Self
[src]
Construct a config key from a string. This does not do any
validation/lowercasing of the string, and should only be used
if the string is guaranteed to be safe. This method is typically
used by derive
implementations.
Arguments
- value - string value.
Example
use preftool::ConfigKey; assert_eq!(ConfigKey::unsafe_from("foo:bar"), "foo:bar");
Trait Implementations
impl Into<String> for ConfigKey
[src]
impl Eq for ConfigKey
[src]
impl AsRef<str> for ConfigKey
[src]
impl Clone for ConfigKey
[src]
fn clone(&self) -> ConfigKey
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq<ConfigKey> for ConfigKey
[src]
fn eq(&self, other: &Self) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<String> for ConfigKey
[src]
fn eq(&self, other: &String) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl PartialEq<str> for ConfigKey
[src]
fn eq(&self, other: &str) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<&'_ String> for ConfigKey
[src]
fn eq(&self, other: &&String) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> PartialEq<&'_ str> for ConfigKey
[src]
fn eq(&self, other: &&str) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl<'_> From<&'_ str> for ConfigKey
[src]
impl<'_> From<&'_ String> for ConfigKey
[src]
impl From<String> for ConfigKey
[src]
impl<'_> From<&'_ ConfigKey> for ConfigKey
[src]
impl Display for ConfigKey
[src]
impl Debug for ConfigKey
[src]
impl Hash for ConfigKey
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,