pub struct Vocabulary {
pub manifest: Manifest,
pub pretokenizer: Option<String>,
pub adapter: Option<AdapterSpec>,
pub tokens: Vec<TokenEntry>,
pub merges: Vec<MergeRule>,
pub statistics: BTreeMap<String, u64>,
pub provenance: Provenance,
pub test_vectors: Vec<TestVector>,
pub representations: Vec<RepresentationRef>,
pub integrity: Option<Integrity>,
}Fields§
§manifest: Manifest§pretokenizer: Option<String>§adapter: Option<AdapterSpec>§tokens: Vec<TokenEntry>§merges: Vec<MergeRule>§statistics: BTreeMap<String, u64>§provenance: Provenance§test_vectors: Vec<TestVector>§representations: Vec<RepresentationRef>§integrity: Option<Integrity>Implementations§
Source§impl Vocabulary
impl Vocabulary
pub fn id(&self) -> &VocabularyId
pub fn version(&self) -> &Version
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn token(&self, id: u32) -> Result<&TokenEntry, KuteError>
Sourcepub fn compute_digest(&self) -> Result<String, KuteError>
pub fn compute_digest(&self) -> Result<String, KuteError>
SHA-256 over the canonical JSON of everything except integrity.
Sourcepub fn digest(&self) -> Result<String, KuteError>
pub fn digest(&self) -> Result<String, KuteError>
The digest recorded in the file, or a freshly computed one.
Sourcepub fn seal(&mut self) -> Result<(), KuteError>
pub fn seal(&mut self) -> Result<(), KuteError>
Record the content digest. Call after the last modification.
Trait Implementations§
Source§impl Clone for Vocabulary
impl Clone for Vocabulary
Source§fn clone(&self) -> Vocabulary
fn clone(&self) -> Vocabulary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Vocabulary
impl Debug for Vocabulary
Source§impl<'de> Deserialize<'de> for Vocabulary
impl<'de> Deserialize<'de> for Vocabulary
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Vocabulary, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Vocabulary, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Vocabulary
impl PartialEq for Vocabulary
Source§impl Serialize for Vocabulary
impl Serialize for Vocabulary
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Vocabulary
Auto Trait Implementations§
impl Forget for Vocabulary
impl Freeze for Vocabulary
impl Move for Vocabulary
impl RefUnwindSafe for Vocabulary
impl Send for Vocabulary
impl Sync for Vocabulary
impl Unpin for Vocabulary
impl UnsafeUnpin for Vocabulary
impl UnwindSafe for Vocabulary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more