pub struct Validator;Expand description
Validator for Rivven inputs
Implementations§
Source§impl Validator
impl Validator
Sourcepub fn validate_identifier(name: &str) -> Result<(), ValidationError>
pub fn validate_identifier(name: &str) -> Result<(), ValidationError>
Validate a SQL-style identifier (slot names, internal identifiers)
§Security
Prevents SQL injection by rejecting:
- Empty strings
- Strings starting with numbers
- Special characters (quotes, semicolons, etc.)
- Excessively long strings
Sourcepub fn validate_topic_name(name: &str) -> Result<(), ValidationError>
pub fn validate_topic_name(name: &str) -> Result<(), ValidationError>
Validate a topic name
Topic names follow Kafka conventions:
- Must start with alphanumeric character
- Can contain alphanumeric, dots, hyphens, and underscores
- Maximum 255 characters
Sourcepub fn validate_message_size(
size: usize,
max: usize,
) -> Result<(), ValidationError>
pub fn validate_message_size( size: usize, max: usize, ) -> Result<(), ValidationError>
Validate message size
Sourcepub fn validate_partition(
partition: u32,
num_partitions: u32,
) -> Result<(), ValidationError>
pub fn validate_partition( partition: u32, num_partitions: u32, ) -> Result<(), ValidationError>
Validate partition number
Sourcepub fn validate_consumer_group_id(id: &str) -> Result<(), ValidationError>
pub fn validate_consumer_group_id(id: &str) -> Result<(), ValidationError>
Validate consumer group ID
Uses the same rules as topic names
Sourcepub fn validate_client_id(id: &str) -> Result<(), ValidationError>
pub fn validate_client_id(id: &str) -> Result<(), ValidationError>
Validate client ID
Uses the same rules as topic names
Sourcepub fn sanitize_for_log(s: &str, max_len: usize) -> String
pub fn sanitize_for_log(s: &str, max_len: usize) -> String
Sanitize a string for safe logging (remove control characters, truncate)
Auto Trait Implementations§
impl Freeze for Validator
impl RefUnwindSafe for Validator
impl Send for Validator
impl Sync for Validator
impl Unpin for Validator
impl UnwindSafe for Validator
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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