tabs/
lib.rs

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#[macro_use]
9pub mod error;
10mod schema;
11mod storage;
12mod store;
13mod sync;
14
15pub use types::Timestamp;
16
17uniffi::custom_type!(Timestamp, i64, {
18    remote,
19    try_lift: |val| Ok(Self(val as u64)),
20    lower: |obj| obj.as_millis() as i64,
21});
22
23uniffi::include_scaffolding!("tabs");
24
25pub use crate::storage::{
26    ClientRemoteTabs, LocalTabsInfo, RemoteTabRecord, TabGroup, TabsDeviceType, Window, WindowType,
27};
28pub use crate::store::{RemoteCommandStore, TabsStore};
29pub use error::{ApiResult, Error, Result, TabsApiError};
30use sync15::DeviceType;
31
32pub use crate::sync::{get_registered_sync_engine, TabsBridgedEngine, TabsEngine};
33
34#[derive(Clone, Eq, PartialEq, Debug)]
35pub enum RemoteCommand {
36    CloseTab { url: String },
37    // eg, CloseInactive, ??
38}
39
40// Tabs that were requested to be closed on other clients
41#[derive(Clone, Eq, PartialEq, Debug)]
42pub struct PendingCommand {
43    pub device_id: String,
44    pub command: RemoteCommand,
45    pub time_requested: Timestamp,
46    pub time_sent: Option<Timestamp>,
47}