it_lilo/lifter/
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 error;
18mod lift_array;
19mod lift_record;
20mod macros;
21mod memory_reader;
22
23pub use error::LiError;
24pub use lift_array::array_lift_memory;
25pub use lift_record::record_lift_memory;
26pub use memory_reader::MemoryReader;
27
28use super::traits::RecordResolvable;
29
30pub use it_memory_traits::MemoryView;
31
32pub type LiResult<T> = std::result::Result<T, error::LiError>;
33
34pub struct ILifter<'r, R: RecordResolvable, MV: MemoryView<Store>, Store: it_memory_traits::Store> {
35    pub reader: MemoryReader<MV, Store>,
36    pub resolver: &'r R,
37}
38
39impl<'r, R: RecordResolvable, MV: MemoryView<Store>, Store: it_memory_traits::Store>
40    ILifter<'r, R, MV, Store>
41{
42    pub fn new(view: MV, resolver: &'r R) -> Self {
43        let reader = MemoryReader::new(view);
44        Self { reader, resolver }
45    }
46}