rdfx 0.23.1

RDF 1.2 data-structures, traits and utilities: terms (incl. triple terms), triples, quads, interpretations, graphs, datasets, unstar/restar reification helpers.
Documentation
use std::borrow::Cow;

use iri_rs::IriBuf;

use crate::CowLiteral;

use super::Term;

pub enum CowTerm<'a> {
    Iri(Cow<'a, IriBuf>),

    Literal(CowLiteral<'a>),
}

impl CowTerm<'_> {
    pub fn into_owned(self) -> Term {
        match self {
            Self::Iri(iri) => Term::Iri(iri.into_owned()),
            Self::Literal(l) => Term::Literal(l.into_owned()),
        }
    }
}

impl From<Term> for CowTerm<'_> {
    fn from(value: Term) -> Self {
        value.into_cow()
    }
}