Debian Codegraph @

third_party/rust/webext-storage/src/lib.rs

raw
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #![allow(unknown_lints)]
6 #![warn(rust_2018_idioms)]
7
8 mod api;
9 mod db;
10 pub mod error;
11 mod ffi;
12 mod migration;
13 mod schema;
14 pub mod store;
15 mod sync;
16
17 pub use migration::MigrationInfo;
18
19 // We publish some constants from non-public modules.
20 pub use sync::STORAGE_VERSION;
21
22 pub use api::SYNC_MAX_ITEMS;
23 pub use api::SYNC_QUOTA_BYTES;
24 pub use api::SYNC_QUOTA_BYTES_PER_ITEM;
25
26 pub use crate::error::{QuotaReason, WebExtStorageApiError};
27 pub use crate::store::WebExtStorageStore;
28 pub use crate::sync::{bridge::WebExtStorageBridgedEngine, SyncedExtensionChange};
29 pub use api::UsageInfo;
30 pub use api::{StorageChanges, StorageValueChange};
31
32 uniffi::include_scaffolding!("webext-storage");
33
34 use serde_json::Value as JsonValue;
35
36 uniffi::custom_type!(JsonValue, String, {
37 remote,
38 try_lift: |val| Ok(serde_json::from_str(val.as_str())?),
39 lower: |obj| obj.to_string(),
40 });
41
42 // Our UDL uses a `Guid` type.
43 use sync_guid::Guid;
44 uniffi::custom_type!(Guid, String, {
45 remote,
46 try_lift: |val| Ok(Guid::new(val.as_str())),
47 lower: |obj| obj.into()
48 });