pub struct TypeConstraint { /* private fields */ }Expand description
Represents a type with optional constraints
Implementations§
Source§impl TypeConstraint
impl TypeConstraint
Sourcepub const fn unconstrained(ty: Type) -> Self
pub const fn unconstrained(ty: Type) -> Self
Create an unconstrained type (const for use in static contexts)
Sourcepub fn with_constraint(ty: Type, constraint: Constraint) -> Self
pub fn with_constraint(ty: Type, constraint: Constraint) -> Self
Create a type with a constraint
Sourcepub fn constraint(&self) -> &Option<Constraint>
pub fn constraint(&self) -> &Option<Constraint>
Get the constraint
Sourcepub fn to_ffi(&self) -> FFITypeConstraint
pub fn to_ffi(&self) -> FFITypeConstraint
Convert to FFI representation
Sourcepub fn from_ffi(ffi: FFITypeConstraint) -> Self
pub fn from_ffi(ffi: FFITypeConstraint) -> Self
Create from FFI representation
Sourcepub fn validate(&self, value: &Value) -> Result<(), Error>
pub fn validate(&self, value: &Value) -> Result<(), Error>
Validate a value against this type constraint
Sourcepub fn is_unconstrained(&self) -> bool
pub fn is_unconstrained(&self) -> bool
Check if this type is unconstrained
Trait Implementations§
Source§impl Clone for TypeConstraint
impl Clone for TypeConstraint
Source§fn clone(&self) -> TypeConstraint
fn clone(&self) -> TypeConstraint
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TypeConstraint
impl Debug for TypeConstraint
Source§impl<'de> Deserialize<'de> for TypeConstraint
impl<'de> Deserialize<'de> for TypeConstraint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TypeConstraint
impl PartialEq for TypeConstraint
Source§impl Serialize for TypeConstraint
impl Serialize for TypeConstraint
impl Copy for TypeConstraint
impl Eq for TypeConstraint
impl StructuralPartialEq for TypeConstraint
Auto Trait Implementations§
impl Freeze for TypeConstraint
impl RefUnwindSafe for TypeConstraint
impl Send for TypeConstraint
impl Sync for TypeConstraint
impl Unpin for TypeConstraint
impl UnwindSafe for TypeConstraint
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)