Struct opencc::OpenCC
[−]
[src]
pub struct OpenCC {
pub config: String,
// some fields omitted
}Fields
config: String
Configuration file
Methods
impl OpenCC[src]
fn new(config: &str) -> OpenCC
fn convert(&self, text: &str) -> Option<String>
Convert a text
Examples
let cc = opencc::OpenCC::new("t2s.json"); cc.convert("乾坤一擲").unwrap(); cc.convert("開放中文轉換").unwrap();
fn close(&self)
Close the underlying libopencc. Will be called automatically when the variable gets out of scope.
fn is_closed(&self) -> bool
Is the underlying libopencc closed
fn last_error() -> Option<String>
Returns the last error message
Safety
Note that this function is the only one which is NOT thread-safe.
Trait Implementations
impl Drop for OpenCC[src]
fn drop(&mut self)
Close the underlying libopencc when it been droped