pub enum SchemaType {
None,
Single(String),
Multiple(Vec<String>),
}Variants§
Implementations§
Source§impl SchemaType
impl SchemaType
pub fn is_none(&self) -> bool
pub fn is_single(&self) -> bool
pub fn is_multiple(&self) -> bool
Sourcepub fn is_or_contains(&self, type: &str) -> bool
pub fn is_or_contains(&self, type: &str) -> bool
Checks if this SchemaType matches or contains the given type string.
Returns true if:
- The schema type is
Singleand matches the given type string, or - The schema type is
Multipleand contains the given type string
Returns false if:
- The schema type is
None, or - The schema type doesn’t match/contain the given type string
§Examples
use yaml_schema::schemas::SchemaType;
// Test with a single type
let single = SchemaType::new("string");
assert!(single.is_or_contains("string"));
assert!(!single.is_or_contains("number"));
// Test with multiple types
let multiple = SchemaType::Multiple(vec!["string".to_string(), "number".to_string()]);
assert!(multiple.is_or_contains("string"));
assert!(multiple.is_or_contains("number"));
assert!(!multiple.is_or_contains("boolean"));
// Test with None (no type specified)
let none = SchemaType::None;
assert!(!none.is_or_contains("string"));Trait Implementations§
Source§impl Debug for SchemaType
impl Debug for SchemaType
Source§impl Default for SchemaType
impl Default for SchemaType
Source§fn default() -> SchemaType
fn default() -> SchemaType
Returns the “default value” for a type. Read more
Source§impl Display for SchemaType
impl Display for SchemaType
Source§impl PartialEq for SchemaType
impl PartialEq for SchemaType
impl StructuralPartialEq for SchemaType
Auto Trait Implementations§
impl Freeze for SchemaType
impl RefUnwindSafe for SchemaType
impl Send for SchemaType
impl Sync for SchemaType
impl Unpin for SchemaType
impl UnsafeUnpin for SchemaType
impl UnwindSafe for SchemaType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.