@@ -323,7 +323,7 @@ pub enum LookupStrategy {
323323/// ```
324324/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
325325///
326- /// use chewing::{dictionary::{Dictionary, DictionaryMut, LookupStrategy, TrieBuf}, syl, zhuyin::Bopomofo};
326+ /// use chewing::{dictionary::{Dictionary, LookupStrategy, TrieBuf}, syl, zhuyin::Bopomofo};
327327///
328328/// let mut dict = TrieBuf::new_in_memory();
329329/// dict.add_phrase(&[syl![Bopomofo::C, Bopomofo::E, Bopomofo::TONE4]], ("測", 100).into())?;
@@ -348,21 +348,20 @@ pub trait Dictionary: Debug {
348348 fn about ( & self ) -> DictionaryInfo ;
349349 /// Returns the dictionary file path if it's backed by a file.
350350 fn path ( & self ) -> Option < & Path > ;
351- fn as_dict_mut ( & mut self ) -> Option < & mut dyn DictionaryMut > ;
352- }
353-
354- /// An interface for updating dictionaries.
355- pub trait DictionaryMut : Debug {
356351 /// Reopens the dictionary if it was changed by a different process
357352 ///
358353 /// It should not fail if the dictionary is read-only or able to sync across
359354 /// processes automatically.
360- fn reopen ( & mut self ) -> Result < ( ) , UpdateDictionaryError > ;
355+ fn reopen ( & mut self ) -> Result < ( ) , UpdateDictionaryError > {
356+ Err ( UpdateDictionaryError { source : None } )
357+ }
361358 /// Flushes all the changes back to the filesystem
362359 ///
363360 /// The change made to the dictionary might not be persisted without
364361 /// calling this method.
365- fn flush ( & mut self ) -> Result < ( ) , UpdateDictionaryError > ;
362+ fn flush ( & mut self ) -> Result < ( ) , UpdateDictionaryError > {
363+ Err ( UpdateDictionaryError { source : None } )
364+ }
366365 /// An method for updating dictionaries.
367366 ///
368367 /// For more about the concept of dictionaries generally, please see the
@@ -373,7 +372,7 @@ pub trait DictionaryMut: Debug {
373372 /// ```
374373 /// # fn main() -> Result<(), Box<dyn std::error::Error>> {
375374 ///
376- /// use chewing::{dictionary::{DictionaryMut , TrieBuf}, syl, zhuyin::Bopomofo};
375+ /// use chewing::{dictionary::{Dictionary , TrieBuf}, syl, zhuyin::Bopomofo};
377376 ///
378377 /// let mut dict = TrieBuf::new_in_memory();
379378 /// dict.add_phrase(&[syl![Bopomofo::C, Bopomofo::E, Bopomofo::TONE4]], ("測", 100).into())?;
@@ -383,25 +382,29 @@ pub trait DictionaryMut: Debug {
383382 /// TODO: doc
384383 fn add_phrase (
385384 & mut self ,
386- syllables : & [ Syllable ] ,
387- phrase : Phrase ,
388- ) -> Result < ( ) , UpdateDictionaryError > ;
389-
385+ _syllables : & [ Syllable ] ,
386+ _phrase : Phrase ,
387+ ) -> Result < ( ) , UpdateDictionaryError > {
388+ Err ( UpdateDictionaryError { source : None } )
389+ }
390390 /// TODO: doc
391391 fn update_phrase (
392392 & mut self ,
393- syllables : & [ Syllable ] ,
394- phrase : Phrase ,
395- user_freq : u32 ,
396- time : u64 ,
397- ) -> Result < ( ) , UpdateDictionaryError > ;
398-
393+ _syllables : & [ Syllable ] ,
394+ _phrase : Phrase ,
395+ _user_freq : u32 ,
396+ _time : u64 ,
397+ ) -> Result < ( ) , UpdateDictionaryError > {
398+ Err ( UpdateDictionaryError { source : None } )
399+ }
399400 /// TODO: doc
400401 fn remove_phrase (
401402 & mut self ,
402- syllables : & [ Syllable ] ,
403- phrase_str : & str ,
404- ) -> Result < ( ) , UpdateDictionaryError > ;
403+ _syllables : & [ Syllable ] ,
404+ _phrase_str : & str ,
405+ ) -> Result < ( ) , UpdateDictionaryError > {
406+ Err ( UpdateDictionaryError { source : None } )
407+ }
405408}
406409
407410/// Errors during dictionary construction.
@@ -447,12 +450,11 @@ pub trait DictionaryBuilder {
447450
448451#[ cfg( test) ]
449452mod tests {
450- use crate :: dictionary:: { Dictionary , DictionaryBuilder , DictionaryMut } ;
453+ use crate :: dictionary:: { Dictionary , DictionaryBuilder } ;
451454
452455 #[ test]
453456 fn ensure_object_safe ( ) {
454457 const _: Option < & dyn Dictionary > = None ;
455- const _: Option < & dyn DictionaryMut > = None ;
456458 const _: Option < & dyn DictionaryBuilder > = None ;
457459 }
458460}
0 commit comments