snarkvm_console_program/data/future/mod.rs
1// Copyright (c) 2019-2026 Provable Inc.
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, DynamicFuture, Identifier, Plaintext, ProgramID, Value};
28use snarkvm_console_network::Network;
29use snarkvm_console_types::prelude::*;
30
31/// A future.
32#[derive(Clone)]
33pub struct Future<N: Network> {
34 /// The program ID.
35 program_id: ProgramID<N>,
36 /// The name of the function.
37 function_name: Identifier<N>,
38 /// The arguments.
39 arguments: Vec<Argument<N>>,
40}
41
42impl<N: Network> Future<N> {
43 /// Initializes a new future.
44 #[inline]
45 pub const fn new(program_id: ProgramID<N>, function_name: Identifier<N>, arguments: Vec<Argument<N>>) -> Self {
46 Self { program_id, function_name, arguments }
47 }
48
49 /// Returns the program ID.
50 #[inline]
51 pub const fn program_id(&self) -> &ProgramID<N> {
52 &self.program_id
53 }
54
55 /// Returns the name of the function.
56 #[inline]
57 pub const fn function_name(&self) -> &Identifier<N> {
58 &self.function_name
59 }
60
61 /// Returns the arguments.
62 #[inline]
63 pub fn arguments(&self) -> &[Argument<N>] {
64 &self.arguments
65 }
66}