marine_module_interface/interface/
mod.rs

1/*
2 * Copyright 2021 Fluence Labs Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17mod errors;
18mod interface_transformer;
19mod itype_to_text;
20mod module_interface;
21mod records_transformer;
22
23pub use errors::InterfaceError;
24pub use interface_transformer::it_to_module_interface;
25pub use itype_to_text::*;
26pub use module_interface::*;
27
28pub type InterfaceResult<T> = std::result::Result<T, InterfaceError>;
29
30use marine_it_interfaces::MITInterfaces;
31
32/// Returns interface of a Marine module.
33pub fn get_interface(mit: &MITInterfaces<'_>) -> InterfaceResult<ModuleInterface> {
34    let it_interface = crate::it_interface::get_interface(mit)?;
35    let interface = it_to_module_interface(it_interface)?;
36
37    Ok(interface)
38}