Skip to main content

shacl_ir/components/
min_length.rs

1use std::fmt::Display;
2
3/// sh:minLength specifies the minimum string length of each value node that
4/// satisfies the condition. This can be applied to any literals and IRIs, but
5/// not to blank nodes.
6///
7/// https://www.w3.org/TR/shacl/#MinLengthConstraintComponent
8#[derive(Debug, Clone)]
9pub struct MinLength {
10    min_length: isize,
11}
12
13impl MinLength {
14    pub fn new(min_length: isize) -> Self {
15        MinLength { min_length }
16    }
17
18    pub fn min_length(&self) -> isize {
19        self.min_length
20    }
21}
22
23impl Display for MinLength {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        write!(f, "MinLength: {}", self.min_length())
26    }
27}