pub struct SqliteRuntime { /* private fields */ }
Implementations§
Source§impl SqliteRuntime
impl SqliteRuntime
pub fn start(pager: SqlitePager) -> SqliteResult<Self>
Sourcepub fn header(&self) -> &SqliteHeader
pub fn header(&self) -> &SqliteHeader
Examples found in repository?
examples/sqlite_info.rs (line 40)
36 fn print_sqlite_info(conn: &SqliteConnection) -> AppResult<()> {
37 const LABEL_WIDTH: usize = 21;
38
39 // TODO:
40 let sqlite_header = conn.runtime().header();
41
42 let mut output = "".to_owned();
43
44 output.push_str(&format!(
45 "{label: <w$}{value}\n",
46 w = LABEL_WIDTH,
47 label = "database page size:",
48 value = u32::from(sqlite_header.page_size())
49 ));
50 output.push_str(&format!(
51 "{label: <w$}{value}\n",
52 w = LABEL_WIDTH,
53 label = "write format:",
54 value =
55 u8::from(sqlite_header.file_format_version_numbers().write_version())
56 ));
57 output.push_str(&format!(
58 "{label: <w$}{value}\n",
59 w = LABEL_WIDTH,
60 label = "read format:",
61 value =
62 u8::from(sqlite_header.file_format_version_numbers().read_version())
63 ));
64 output.push_str(&format!(
65 "{label: <w$}{value}\n",
66 w = LABEL_WIDTH,
67 label = "reserved bytes:",
68 value = **sqlite_header.reserved_bytes_per_page()
69 ));
70 output.push_str(&format!(
71 "{label: <w$}{value}\n",
72 w = LABEL_WIDTH,
73 label = "file change counter:",
74 value = **sqlite_header.file_change_counter()
75 ));
76
77 output.push_str(&format!(
78 "{label: <w$}{value}\n",
79 w = LABEL_WIDTH,
80 label = "database page count:",
81 value = **sqlite_header.db_filesize_in_pages()
82 ));
83
84 output.push_str(&format!(
85 "{label: <w$}{value}\n",
86 w = LABEL_WIDTH,
87 label = "freelist page count:",
88 value = **sqlite_header.freelist_pages().total()
89 ));
90
91 output.push_str(&format!(
92 "{label: <w$}{value}\n",
93 w = LABEL_WIDTH,
94 label = "schema cookie:",
95 value = **sqlite_header.schema_cookie()
96 ));
97
98 output.push_str(&format!(
99 "{label: <w$}{value}\n",
100 w = LABEL_WIDTH,
101 label = "schema format:",
102 value = u32::from(sqlite_header.schema_format())
103 ));
104
105 output.push_str(&format!(
106 "{label: <w$}{value}\n",
107 w = LABEL_WIDTH,
108 label = "default cache size:",
109 value = **sqlite_header.suggested_cache_size()
110 ));
111
112 output.push_str(&format!(
113 "{label: <w$}{value}\n",
114 w = LABEL_WIDTH,
115 label = "autovacuum top root:",
116 value = **sqlite_header
117 .incremental_vacuum_settings()
118 .largest_root_btree_page()
119 ));
120
121 output.push_str(&format!(
122 "{label: <w$}{value}\n",
123 w = LABEL_WIDTH,
124 label = "incremental vacuum:",
125 value = u32::from(
126 sqlite_header
127 .incremental_vacuum_settings()
128 .incremental_vacuum_mode()
129 )
130 ));
131
132 output.push_str(&format!(
133 "{label: <w$}{value}\n",
134 w = LABEL_WIDTH,
135 label = "text encoding:",
136 value = sqlite_header.database_text_encoding()
137 ));
138
139 output.push_str(&format!(
140 "{label: <w$}{value}\n",
141 w = LABEL_WIDTH,
142 label = "user version:",
143 value = **sqlite_header.user_version()
144 ));
145
146 output.push_str(&format!(
147 "{label: <w$}{value}\n",
148 w = LABEL_WIDTH,
149 label = "application id:",
150 value = **sqlite_header.application_id()
151 ));
152
153 output.push_str(&format!(
154 "{label: <w$}{value}\n",
155 w = LABEL_WIDTH,
156 label = "software version:",
157 value = **sqlite_header.write_library_version()
158 ));
159
160 println!("{output}");
161 Ok(())
162 }
pub fn tables(&self) -> SqliteResult<Vec<SqliteSchema>>
pub fn pager(&self) -> &SqlitePager
pub fn pager_mut(&mut self) -> &mut SqlitePager
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqliteRuntime
impl !RefUnwindSafe for SqliteRuntime
impl Send for SqliteRuntime
impl Sync for SqliteRuntime
impl Unpin for SqliteRuntime
impl !UnwindSafe for SqliteRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more