1use crate::prelude::*;
2use skia_bindings::{self as sb, skia_textlayout_ParagraphCache};
3use std::fmt;
4
5pub type ParagraphCache = Handle<skia_textlayout_ParagraphCache>;
6
7impl NativeDrop for skia_textlayout_ParagraphCache {
8 fn drop(&mut self) {
9 unsafe { sb::C_ParagraphCache_destruct(self) }
10 }
11}
12
13impl fmt::Debug for ParagraphCache {
14 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
15 f.debug_struct(name:"ParagraphCache").finish()
16 }
17}
18
19impl ParagraphCache {
20 pub fn new() -> ParagraphCache {
21 ParagraphCache::from_native_c(unsafe { skia_textlayout_ParagraphCache::new() })
22 }
23
24 pub fn abandon(&mut self) {
25 unsafe { self.native_mut().abandon() }
26 }
27
28 pub fn reset(&mut self) {
29 unsafe { self.native_mut().reset() }
30 }
31
32 pub fn print_statistics(&mut self) {
33 unsafe { self.native_mut().printStatistics() }
34 }
35
36 pub fn turn_on(&mut self, value: bool) {
37 self.native_mut().fCacheIsOn = value
38 }
39
40 pub fn count(&mut self) -> i32 {
41 unsafe { sb::C_ParagraphCache_count(self.native_mut()) }
42 }
43}
44