Skip to main content

s2_common/
lib.rs

1//! Common types and utilities shared across S2 crates.
2
3pub mod access;
4pub mod basin;
5pub mod caps;
6pub mod config;
7pub mod deep_size;
8pub mod encryption;
9pub mod http;
10pub mod location;
11pub mod maybe;
12pub mod metrics;
13pub mod read_extent;
14pub mod record;
15pub mod resources;
16pub mod stream;
17mod strings;
18
19#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
20#[error("{0}")]
21pub struct ValidationError(pub String);
22
23impl From<String> for ValidationError {
24    fn from(value: String) -> Self {
25        ValidationError(value)
26    }
27}
28
29impl From<&str> for ValidationError {
30    fn from(value: &str) -> Self {
31        ValidationError(value.to_owned())
32    }
33}
34
35impl From<record::FencingTokenTooLongError> for ValidationError {
36    fn from(e: record::FencingTokenTooLongError) -> Self {
37        ValidationError(e.to_string())
38    }
39}