1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 //! Cloud Service Synchronization Crate, implemented in Rust. This crate is used as bridge between 17 //! upper C++ apk and JS cloud service. C++ will call C-ffi of Rust, and Rust will use IPC to 18 //! connect to JS. 19 20 /// Module of C FFI adapter. 21 /// 22 /// # Attention 23 /// For pointers passed into functions as parameters, they should remain valid throughout the 24 /// lifetime of callees, or memory issues and undefined behavior might happen. 25 /// 26 /// Besides, for String parameters, users need to guarantee that the source char array doesn't 27 /// contain non-UTF8 literals, and the length passed in is valid. 28 pub mod c_adapter; 29 30 /// Module of IPC Conn Serialization and Deserialization. 31 pub mod ipc_conn; 32 33 /// Module of Cloud Service Synchronization, providing structs of CloudAssetLoader, CloudDatabase, 34 /// CloudSync and relating structs and functions. 35 pub mod service_impl; 36 37 use crate::service_impl::error::SyncError; 38 39 /// Sync Result returned by CloudAssetLoader, CloudDatabase, and CloudSync. 40 pub type SyncResult<T> = Result<T, SyncError>; 41