Struct strong::Strong[][src]

#[repr(transparent)]pub struct Strong<Ctx: Validator> { /* fields omitted */ }

Strongly typed str

Implementations

impl<Ctx: Validator> Strong<Ctx>[src]

pub fn validate<S: AsRef<str> + ?Sized>(s: &S) -> Result<&Self, Ctx::Err>[src]

Constructs from str.

pub unsafe fn no_validate<S: AsRef<str> + ?Sized>(s: &S) -> &Self[src]

Constructs from str without validation.

Safety

This function allows us to create invalid Strong.

pub fn as_str(&self) -> &str[src]

Converts to str.

pub fn as_bytes(&self) -> &[u8][src]

impl<Ctx: Validator> Strong<Ctx>[src]

pub fn valid(&self) -> Result<&Self, Ctx::Err>[src]

Re-validates self

pub fn to_strong_buf(&self) -> StrongBuf<Ctx>[src]

Converts to StrongBuf.

pub fn count_chars(&self) -> usize[src]

pub fn map<F>(&self, f: F) -> Result<&Strong<Ctx>, Ctx::Err> where
    F: FnOnce(&str) -> &str
[src]

Map with function: &str -> &str and validation

pub fn trim(&self) -> Result<&Strong<Ctx>, Ctx::Err>[src]

pub fn trim_start(&self) -> Result<&Strong<Ctx>, Ctx::Err>[src]

pub fn trim_end(&self) -> Result<&Strong<Ctx>, Ctx::Err>[src]

Trait Implementations

impl<'expr, Ctx: Validator> AsExpression<Nullable<SqlStrong<Ctx>>> for &'expr Strong<Ctx>[src]

type Expression = Bound<Nullable<SqlStrong<Ctx>>, Self>

The expression being returned

impl<'expr, Ctx: Validator> AsExpression<SqlStrong<Ctx>> for &'expr Strong<Ctx>[src]

type Expression = Bound<SqlStrong<Ctx>, Self>

The expression being returned

impl<Ctx> AsRef<Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator
[src]

impl<Ctx> Borrow<Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator
[src]

impl<Ctx> Debug for Strong<Ctx> where
    Ctx: Validator + DebugTransparent
[src]

impl<'de, Ctx> Deserialize<'de> for &'de Strong<Ctx> where
    Ctx: Validator,
    Ctx::Err: Display
[src]

impl<Ctx> Display for Strong<Ctx> where
    Ctx: Validator + DisplayTransparent
[src]

impl<Ctx> Eq for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + EqTransparent
[src]

impl<Ctx: HashTransparent> Hash for Strong<Ctx> where
    Ctx: Validator
[src]

impl<Ctx> Ord for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + EqTransparent + PartialOrdTransparent + OrdTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<&'a Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<Cow<'a, Strong<Ctx>>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<Cow<'a, Strong<Ctx>>> for &'b Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<Ctx> PartialEq<Strong<Ctx>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<StrongBuf<Ctx>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialEq<StrongBuf<Ctx>> for &'a Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<&'a Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<Cow<'a, Strong<Ctx>>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<Cow<'a, Strong<Ctx>>> for &'b Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<Ctx> PartialOrd<Strong<Ctx>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<Strong<Ctx>> for StrongBuf<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<StrongBuf<Ctx>> for Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<'a, 'b, Ctx> PartialOrd<StrongBuf<Ctx>> for &'a Strong<Ctx> where
    Ctx: Validator + PartialEqTransparent + PartialOrdTransparent
[src]

impl<Ctx> Serialize for Strong<Ctx> where
    Ctx: Validator
[src]

impl<Ctx> ToOwned for Strong<Ctx> where
    Ctx: Validator
[src]

type Owned = StrongBuf<Ctx>

The resulting type after obtaining ownership.

impl<Ctx: Validator, __DB> ToSql<Nullable<SqlStrong<Ctx>>, __DB> for Strong<Ctx> where
    __DB: Backend,
    Self: ToSql<SqlStrong<Ctx>, __DB>, 
[src]

impl<Ctx, DB> ToSql<SqlStrong<Ctx>, DB> for Strong<Ctx> where
    Ctx: Validator + DebugTransparent,
    DB: Backend
[src]

impl<'a, Ctx> TryFrom<&'a str> for &'a Strong<Ctx> where
    Ctx: Validator
[src]

type Error = Ctx::Err

The type returned in the event of a conversion error.

Auto Trait Implementations

impl<Ctx> RefUnwindSafe for Strong<Ctx> where
    Ctx: RefUnwindSafe

impl<Ctx> Send for Strong<Ctx> where
    Ctx: Send

impl<Ctx> !Sized for Strong<Ctx>

impl<Ctx> Sync for Strong<Ctx> where
    Ctx: Sync

impl<Ctx> Unpin for Strong<Ctx> where
    Ctx: Unpin

impl<Ctx> UnwindSafe for Strong<Ctx> where
    Ctx: UnwindSafe

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

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

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.