ssevents/validate
Explicit validation helpers for domain values.
Values
pub fn max_data_bytes(
event: event.Event,
max max: Int,
) -> Result(event.Event, error.SseError)
pub fn max_data_bytes_checked(
event: event.Event,
max max: Int,
) -> Result(
Result(event.Event, error.SseError),
limit.LimitConfigError,
)
Like max_data_bytes, but returns the argument-validation failure
as a LimitConfigError instead of panicking. Use this when max
comes from dynamic input.
The outer Result distinguishes argument-validation failures (a
configuration error the caller can surface up the chain) from
event-validation failures (the inner Result(event.Event, SseError)
reporting whether the event itself fits the configured limit).
pub fn validate_event_name(
name: String,
) -> Result(String, error.SseError)
pub fn validate_id(id: String) -> Result(String, error.SseError)
pub fn validate_retry(
milliseconds: Int,
) -> Result(Int, error.SseError)