Skip to main content

brooks_lib/processing/
interpret.rs

1// brooks, Copyright 2026, Will Hawkins
2//
3// This file is part of brooks.
4
5// This file is free software: you can redistribute it and/or modify
6// it under the terms of the GNU General Public License as published by
7// the Free Software Foundation, either version 3 of the License, or
8// (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18//! Interface for interpreting CDNI Metadata in a Particular Context
19
20use std::fmt::Debug;
21
22/// TODO
23pub type InterpretationResult<Ck, Res, Error> = Result<(Ck, Res), Box<Error>>;
24
25/// Interpret a validated representation of a given piece of Metadata Information.
26pub trait Interpreter<Ck, Res, Interest, Error>: Debug {
27    /// Perform the semantics of the MI.
28    fn interpret(&self, input: Ck) -> InterpretationResult<Ck, Res, Error>;
29
30    fn at(&self, interest: Interest) -> bool;
31}