xapi_rs/data/canonical.rs
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3use crate::MyLanguageTag;
4
5/// Trait implemented by types that can produce a _canonical_ form of their
6/// instances.
7///
8/// Needed to comply w/ xAPI requirement when responding to _Statement_ resource
9/// **`GET`** requests.
10pub trait Canonical {
11 /// Reduce `self` to conform to its canonical format as defined in xAPI
12 /// keeping the most appropriate entry given a list of preferred language
13 /// tags.
14 fn canonicalize(&mut self, language_tags: &[MyLanguageTag]);
15}