pub trait IntoCheck:
Sized
+ AsRef<str>
+ 'static {
// Required method
fn check<I: Invariant>(self) -> Result<Check<I, Self>, I::Error>;
}Expand description
Conversion into a Check.
Required Methods§
Sourcefn check<I: Invariant>(self) -> Result<Check<I, Self>, I::Error>
fn check<I: Invariant>(self) -> Result<Check<I, Self>, I::Error>
Returns a validated Check owning self.
Note that Check uses the input of IntoCheck::check as its backing
storage, meaning that "this".check() will return a Check<I, &'static str>.
Although this is technically valid, it’s strongly recommended to use
Ck for string slices instead to avoid confusion.
§Examples
Creating a Unicode ident from a formatted string:
use strck_ident::{Check, Ck, IntoCheck, unicode::UnicodeIdent};
fn wrapper_name(name: &Ck<UnicodeIdent>) -> Check<UnicodeIdent> {
format!("lil_{name}").check().unwrap()
}Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.