pub struct UserDictionary {
pub dict: UserPrefixDictionary,
}Expand description
dict archives with the exact field sequence the pre-v6
PrefixDictionary used, which is what keeps previously-built user
dictionary .bin files loading across the v6 system-dictionary format
break – rkyv 0.8 archives structurally, without type names. See
UserPrefixDictionary’s type-level comment before touching either type.
Fields§
§dict: UserPrefixDictionaryImplementations§
Source§impl UserDictionary
impl UserDictionary
Sourcepub fn remap_context_ids(&mut self, map: &ContextIdMap)
pub fn remap_context_ids(&mut self, map: &ContextIdMap)
Relabel this dictionary’s context IDs with a system dictionary’s permutation.
User dictionaries are always compiled in the original context-ID space, which
keeps a built .bin portable across remapped and un-remapped system
dictionaries. When one is attached to a system dictionary built with
connection_id_mapping, its left_id/right_id must be moved into the same
space, or every connection cost it participates in would address the wrong
matrix cell — silently, since the IDs stay in range.
Entries live in vals_data as a flat WordEntry::SERIALIZED_LEN-byte stride
with left_id at offset 6 and right_id at offset 8 (little endian), so this
rewrites those two u16s in place. IDs outside the permutation are left
untouched, matching the builder’s behaviour for malformed IDs.
§Arguments
map- The permutation persisted in the system dictionary’s metadata.
pub fn load(user_dict_data: &[u8]) -> LinderaResult<UserDictionary>
pub fn word_details(&self, word_id: usize) -> Vec<&str>
Trait Implementations§
Source§impl Archive for UserDictionarywhere
UserPrefixDictionary: Archive,
impl Archive for UserDictionarywhere
UserPrefixDictionary: Archive,
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§type Archived = ArchivedUserDictionary
type Archived = ArchivedUserDictionary
Source§type Resolver = UserDictionaryResolver
type Resolver = UserDictionaryResolver
Source§impl Clone for UserDictionary
impl Clone for UserDictionary
Source§fn clone(&self) -> UserDictionary
fn clone(&self) -> UserDictionary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for UserDictionary
impl<'de> Deserialize<'de> for UserDictionary
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<__D: Fallible + ?Sized> Deserialize<UserDictionary, __D> for Archived<UserDictionary>where
UserPrefixDictionary: Archive,
<UserPrefixDictionary as Archive>::Archived: Deserialize<UserPrefixDictionary, __D>,
impl<__D: Fallible + ?Sized> Deserialize<UserDictionary, __D> for Archived<UserDictionary>where
UserPrefixDictionary: Archive,
<UserPrefixDictionary as Archive>::Archived: Deserialize<UserPrefixDictionary, __D>,
Source§fn deserialize(
&self,
deserializer: &mut __D,
) -> Result<UserDictionary, <__D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut __D, ) -> Result<UserDictionary, <__D as Fallible>::Error>
Source§impl Serialize for UserDictionary
impl Serialize for UserDictionary
Source§impl<__S: Fallible + ?Sized> Serialize<__S> for UserDictionarywhere
UserPrefixDictionary: Serialize<__S>,
impl<__S: Fallible + ?Sized> Serialize<__S> for UserDictionarywhere
UserPrefixDictionary: Serialize<__S>,
Auto Trait Implementations§
impl Freeze for UserDictionary
impl RefUnwindSafe for UserDictionary
impl Send for UserDictionary
impl Sync for UserDictionary
impl Unpin for UserDictionary
impl UnsafeUnpin for UserDictionary
impl UnwindSafe for UserDictionary
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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
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> ⓘ
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> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.