snarkvm_console_program/data/future/
mod.rs

1// Copyright 2024 Aleo Network Foundation
2// This file is part of the snarkVM library.
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
16mod argument;
17pub use argument::Argument;
18
19mod bytes;
20mod equal;
21mod find;
22mod parse;
23mod serialize;
24mod to_bits;
25mod to_fields;
26
27use crate::{Access, Identifier, Plaintext, ProgramID, Value};
28use snarkvm_console_network::Network;
29use snarkvm_console_types::prelude::*;
30
31// TODO (@d0cd). Implement `FromBytes` and `FromBits` for `Future`.
32
33/// A future.
34#[derive(Clone)]
35pub struct Future<N: Network> {
36    /// The program ID.
37    program_id: ProgramID<N>,
38    /// The name of the function.
39    function_name: Identifier<N>,
40    /// The arguments.
41    arguments: Vec<Argument<N>>,
42}
43
44impl<N: Network> Future<N> {
45    /// Initializes a new future.
46    #[inline]
47    pub const fn new(program_id: ProgramID<N>, function_name: Identifier<N>, arguments: Vec<Argument<N>>) -> Self {
48        Self { program_id, function_name, arguments }
49    }
50
51    /// Returns the program ID.
52    #[inline]
53    pub const fn program_id(&self) -> &ProgramID<N> {
54        &self.program_id
55    }
56
57    /// Returns the name of the function.
58    #[inline]
59    pub const fn function_name(&self) -> &Identifier<N> {
60        &self.function_name
61    }
62
63    /// Returns the arguments.
64    #[inline]
65    pub fn arguments(&self) -> &[Argument<N>] {
66        &self.arguments
67    }
68}