Skip to main content

HotReloadDictionary

Struct HotReloadDictionary 

Source
pub struct HotReloadDictionary { /* private fields */ }
Expand description

핫 리로드 가능한 사전

RwLock으로 동시 접근을 제어하며, Copy-on-Write 전략으로 무중단 업데이트를 지원합니다.

Implementations§

Source§

impl HotReloadDictionary

Source

pub fn new<P>(dicdir: P) -> Result<HotReloadDictionary, DictError>
where P: AsRef<Path>,

사전 디렉토리에서 핫 리로드 사전 생성

§Arguments
  • dicdir - 사전 디렉토리 경로
§Errors
  • 사전 파일을 찾을 수 없는 경우
  • 사전 파일 포맷이 잘못된 경우
Source

pub fn new_default() -> Result<HotReloadDictionary, DictError>

기본 경로에서 핫 리로드 사전 생성

§Errors

Returns an error if the dictionary files cannot be loaded.

Source

pub const fn with_max_history(self, max_history: usize) -> HotReloadDictionary

최대 버전 히스토리 크기 설정

Source

pub const fn with_max_delta_queue( self, max_delta_queue: usize, ) -> HotReloadDictionary

최대 델타 큐 크기 설정

Source

pub fn current_version(&self) -> u64

현재 버전 반환

Source

pub fn dicdir(&self) -> &Path

사전 디렉토리 경로 반환

Source

pub fn lookup(&self, surface: &str) -> Result<Vec<Entry>, DictError>

엔트리 조회 (시스템 사전 + 사용자 사전)

§Arguments
  • surface - 검색할 표면형
§Errors

Returns an error if the dictionary lock cannot be acquired.

Source

pub fn add_entry( &self, surface: impl Into<String>, pos: impl Into<String>, cost: i16, reading: Option<String>, ) -> Result<u64, DictError>

실시간 엔트리 추가

§Arguments
  • surface - 표면형
  • pos - 품사
  • cost - 비용 (낮을수록 우선)
  • reading - 읽기 (선택)
§Errors

Returns an error if the dictionary lock cannot be acquired.

Source

pub fn remove_entry(&self, surface: &str) -> Result<(u64, usize), DictError>

엔트리 제거

§Arguments
  • surface - 제거할 표면형
§Returns

제거된 엔트리 수

§Errors

Returns an error if the dictionary lock cannot be acquired.

Source

pub fn update_entry<F>( &self, surface: &str, update_fn: F, ) -> Result<u64, DictError>
where F: Fn(&mut UserEntry),

엔트리 수정

§Arguments
  • surface - 수정할 표면형
  • update_fn - 업데이트 함수
§Errors

Returns an error if the dictionary lock cannot be acquired.

Source

pub fn apply_delta(&self, delta: DeltaUpdate) -> Result<u64, DictError>

델타 업데이트 적용

여러 변경 사항을 하나의 트랜잭션으로 적용합니다.

§Arguments
  • delta - 델타 업데이트
§Errors

Returns an error if the dictionary lock cannot be acquired.

Source

pub fn reload_system_dict(&self) -> Result<u64, DictError>

시스템 사전 리로드

사전 파일이 변경되었을 때 호출됩니다.

§Errors

Returns an error if the dictionary files cannot be reloaded or the lock cannot be acquired.

Source

pub fn rollback(&self, target_version: u64) -> Result<(), DictError>

특정 버전으로 롤백

§Arguments
  • target_version - 롤백할 버전
§Errors

Returns an error if the version is not found in history or locks cannot be acquired.

Source

pub fn version_history(&self) -> Result<Vec<VersionInfo>, DictError>

버전 히스토리 조회

§Errors

Returns an error if locks cannot be acquired.

Source

pub fn delta_history(&self) -> Result<Vec<DeltaUpdate>, DictError>

델타 히스토리 조회

§Errors

Returns an error if the lock cannot be acquired.

Source

pub fn export_user_dict(&self) -> Result<UserDictionary, DictError>

사용자 사전 내보내기

§Errors

Returns an error if the lock cannot be acquired.

Source

pub fn import_user_dict( &self, user_dict: UserDictionary, ) -> Result<u64, DictError>

사용자 사전 가져오기

§Errors

Returns an error if the lock cannot be acquired.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.