Struct git_config::parser::Key[][src]

pub struct Key<'a>(pub Cow<'a, str>);

Wrapper struct for key names, since keys are case-insensitive.

Methods from Deref<Target = Cow<'a, str>>

pub const fn is_borrowed(&self) -> bool[src]

🔬 This is a nightly-only experimental API. (cow_is_borrowed)

Returns true if the data is borrowed, i.e. if to_mut would require additional work.

Examples

#![feature(cow_is_borrowed)]
use std::borrow::Cow;

let cow = Cow::Borrowed("moo");
assert!(cow.is_borrowed());

let bull: Cow<'_, str> = Cow::Owned("...moo?".to_string());
assert!(!bull.is_borrowed());

pub const fn is_owned(&self) -> bool[src]

🔬 This is a nightly-only experimental API. (cow_is_borrowed)

Returns true if the data is owned, i.e. if to_mut would be a no-op.

Examples

#![feature(cow_is_borrowed)]
use std::borrow::Cow;

let cow: Cow<'_, str> = Cow::Owned("moo".to_string());
assert!(cow.is_owned());

let bull = Cow::Borrowed("...moo?");
assert!(!bull.is_owned());

pub fn to_mut(&mut self) -> &mut <B as ToOwned>::Owned1.0.0[src]

Acquires a mutable reference to the owned form of the data.

Clones the data if it is not already owned.

Examples

use std::borrow::Cow;

let mut cow = Cow::Borrowed("foo");
cow.to_mut().make_ascii_uppercase();

assert_eq!(
  cow,
  Cow::Owned(String::from("FOO")) as Cow<str>
);

Trait Implementations

impl<'a> Clone for Key<'a>[src]

impl<'a> Debug for Key<'a>[src]

impl<'a> Default for Key<'a>[src]

impl<'a> Deref for Key<'a>[src]

type Target = Cow<'a, str>

The resulting type after dereferencing.

impl<'a> DerefMut for Key<'a>[src]

impl Display for Key<'_>[src]

impl<'a> Eq for Key<'a>[src]

impl<'a> From<&'a str> for Key<'a>[src]

impl<'a> From<Cow<'a, str>> for Key<'a>[src]

impl Hash for Key<'_>[src]

impl<'a> Ord for Key<'a>[src]

impl PartialEq<Key<'_>> for Key<'_>[src]

impl PartialOrd<Key<'_>> for Key<'_>[src]

impl<'a> StructuralEq for Key<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Key<'a>

impl<'a> Send for Key<'a>

impl<'a> Sync for Key<'a>

impl<'a> Unpin for Key<'a>

impl<'a> UnwindSafe for Key<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.