shex_ast 0.2.15

RDF data shapes implementation in Rust
Documentation
use rbe::Key;
use rudof_iri::IriS;
use serde::Serialize;
use std::fmt::Display;

#[derive(PartialEq, Eq, Hash, Debug, Default, Clone, Serialize)]
pub struct Pred {
    iri: IriS,
}

impl Pred {
    pub fn new(iri: IriS) -> Self {
        Pred { iri }
    }

    pub fn new_unchecked(str: &str) -> Self {
        Pred {
            iri: IriS::new_unchecked(str),
        }
    }

    pub fn iri(&self) -> &IriS {
        &self.iri
    }
}

impl Display for Pred {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "{}", self.iri)
    }
}

impl From<IriS> for Pred {
    fn from(iri: IriS) -> Self {
        Pred { iri }
    }
}

impl Key for Pred {}