pub enum ColumnSpec {
Single(String),
Multiple(Vec<String>),
}Expand description
Specification for columns in a constraint.
This enum allows constraints to work with either a single column or multiple columns, providing a unified interface for both cases.
§Examples
use term_guard::core::ColumnSpec;
// Single column
let single = ColumnSpec::Single("user_id".to_string());
// Multiple columns
let multiple = ColumnSpec::Multiple(vec!["email".to_string(), "phone".to_string()]);
// Convert from various types
let from_str = ColumnSpec::from("user_id");
let from_vec = ColumnSpec::from(vec!["col1", "col2"]);Variants§
Implementations§
Source§impl ColumnSpec
impl ColumnSpec
Sourcepub fn as_vec(&self) -> Vec<&str>
pub fn as_vec(&self) -> Vec<&str>
Returns the columns as a vector, regardless of whether this is a single or multiple column spec.
Sourcepub fn is_multiple(&self) -> bool
pub fn is_multiple(&self) -> bool
Returns true if this is a multiple column specification.
Sourcepub fn to_multiple(self) -> Vec<String>
pub fn to_multiple(self) -> Vec<String>
Converts to a multiple column specification, even if currently single.
Trait Implementations§
Source§impl Clone for ColumnSpec
impl Clone for ColumnSpec
Source§fn clone(&self) -> ColumnSpec
fn clone(&self) -> ColumnSpec
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColumnSpec
impl Debug for ColumnSpec
Source§impl From<&str> for ColumnSpec
impl From<&str> for ColumnSpec
Source§impl From<String> for ColumnSpec
impl From<String> for ColumnSpec
Source§impl PartialEq for ColumnSpec
impl PartialEq for ColumnSpec
impl Eq for ColumnSpec
impl StructuralPartialEq for ColumnSpec
Auto Trait Implementations§
impl Freeze for ColumnSpec
impl RefUnwindSafe for ColumnSpec
impl Send for ColumnSpec
impl Sync for ColumnSpec
impl Unpin for ColumnSpec
impl UnwindSafe for ColumnSpec
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more