| 1 | use superrust-analyzer cargo lzzzz 2.0.0 lz4f/::{apirust-analyzer cargo lzzzz 2.0.0 lz4f/api/::DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#, Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#}; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::syncrust-analyzer cargo std https://github.com/rust-lang/rust/library/std sync/::Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#; |
| 3 | |
| 4 | /// A pre-compiled dictionary for the efficient compression. |
| 5 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 6 | pub struct Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#(Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#<DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#>); |
| 7 | |
| 8 | impl Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary# { |
| 9 | /// Builds a new `Dictionary`. |
| 10 | pub fn newrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]new().(data: &[u8]) -> Resultrust-analyzer cargo lzzzz 2.0.0 lz4f/error/Result#<Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]> { |
| 11 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Selfrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary](Arcrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/Arc#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc sync/impl#[`Arc<T>`]new().(DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle#::newrust-analyzer cargo lzzzz 2.0.0 lz4f/api/impl#[DictionaryHandle]new().(data)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().))) |
| 12 | } |
| 13 | |
| 14 | pub(craterust-analyzer cargo lzzzz 2.0.0 crate/) fn handlerust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]handle().(&self) -> &DictionaryHandlerust-analyzer cargo lzzzz 2.0.0 lz4f/api/DictionaryHandle# { |
| 15 | &self.0rust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#0. |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | #[cfg(test)] |
| 20 | mod testsrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/tests/ { |
| 21 | use superrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/::Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#; |
| 22 | |
| 23 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 24 | fn create_dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/tests/create_dictionary().() { |
| 25 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#::newrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]new().(&[]).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 26 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(Dictionaryrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/Dictionary#::newrust-analyzer cargo lzzzz 2.0.0 lz4f/dictionary/impl#[Dictionary]new().(&b"quick brown fox jumps over the lazy dog"[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()...]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).is_okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_ok().()); |
| 27 | } |
| 28 | } |