[][src]Struct valid::FieldName

pub struct FieldName(pub Cow<'static, str>);

Represents the field level context for validation functions. Its value is the name of the field to be validated.

Implementations

impl FieldName[src]

pub fn unwrap(self) -> Cow<'static, str>[src]

Unwraps this field name context and returns the field name itself

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

pub 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 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());

Trait Implementations

impl Clone for FieldName[src]

impl Debug for FieldName[src]

impl Deref for FieldName[src]

type Target = Cow<'static, str>

The resulting type after dereferencing.

impl Eq for FieldName[src]

impl<A> From<A> for FieldName where
    A: Into<Cow<'static, str>>, 
[src]

impl PartialEq<FieldName> for FieldName[src]

impl StructuralEq for FieldName[src]

impl StructuralPartialEq for FieldName[src]

impl<T> Validate<AssertFalse, FieldName> for T where
    T: HasCheckedValue
[src]

impl<T> Validate<AssertTrue, FieldName> for T where
    T: HasCheckedValue
[src]

impl<T> Validate<Bound<T>, FieldName> for T where
    T: PartialOrd + Clone + Into<Value>, 
[src]

impl<T> Validate<CharCount, FieldName> for T where
    T: HasCharCount
[src]

impl<'a, T, A> Validate<Contains<'a, A>, FieldName> for T where
    T: HasMember<A> + Into<Value>,
    A: Clone + Into<Value>, 
[src]

impl<T> Validate<Digits, FieldName> for T where
    T: HasDecimalDigits
[src]

impl<T> Validate<Length, FieldName> for T where
    T: HasLength
[src]

impl<T> Validate<NonZero, FieldName> for T where
    T: HasZeroValue + Into<Value>, 
[src]

impl<T> Validate<NotEmpty, FieldName> for T where
    T: HasEmptyValue
[src]

impl Validate<Pattern, FieldName> for String[src]

Auto Trait Implementations

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> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.