commonMain.io.github.lyxnx.util.validation.Validator.kt Maven / Gradle / Ivy
package io.github.lyxnx.util.validation
/**
* A validator that takes [T] as the input to validate, and returns [R] as its validation result
*
* @param T the input to validate
* @param R the result from validating
*/
public fun interface TypeValidator {
/**
* Validates [input], returning [R] as its result
*/
public fun validate(input: T?): R
}
/**
* An implementation of a [TypeValidator] that takes a string as its input and returns some result, [R]
*/
public fun interface StringInputValidator : TypeValidator
/**
* Represents the result of an input validation
*/
public interface ValidationResult {
/**
* Whether the result is a valid, successful result
*/
public val isValid: Boolean
}