Skip to content

Commit 085c1af

Browse files
authored
chore: add field accessors for Wasm and FunctionVersion (#469)
1 parent 63bd9cf commit 085c1af

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/functions/function.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,23 @@ pub struct FunctionVersion {
7777
/// The environment variables available to this function via the WASI environment interface.
7878
pub environment: std::collections::HashMap<String, EnvironmentValue>,
7979
}
80+
impl FunctionVersion {
81+
/// The unique identifier for this function version.
82+
pub fn version_id(&self) -> &FunctionVersionId {
83+
&self.version_id
84+
}
85+
86+
/// The wasm ID this function uses.
87+
pub fn wasm_version_id(&self) -> &WasmVersionId {
88+
&self.wasm_version_id
89+
}
90+
91+
/// The environment variables available to this function via the WASI environment interface.
92+
pub fn environment(&self) -> &std::collections::HashMap<String, EnvironmentValue> {
93+
&self.environment
94+
}
95+
}
96+
8097
impl From<momento_protos::function_types::FunctionVersion> for FunctionVersion {
8198
fn from(proto: momento_protos::function_types::FunctionVersion) -> Self {
8299
let momento_protos::function_types::FunctionVersion {
@@ -146,6 +163,23 @@ pub struct Wasm {
146163
name: String,
147164
description: String,
148165
}
166+
impl Wasm {
167+
/// The unique identifier for this wasm artifact.
168+
pub fn id(&self) -> &WasmVersionId {
169+
&self.id
170+
}
171+
172+
/// The name of this wasm artifact.
173+
pub fn name(&self) -> &str {
174+
&self.name
175+
}
176+
177+
/// The description of this wasm artifact.
178+
pub fn description(&self) -> &str {
179+
&self.description
180+
}
181+
}
182+
149183
impl From<momento_protos::function_types::Wasm> for Wasm {
150184
fn from(proto: momento_protos::function_types::Wasm) -> Self {
151185
let momento_protos::function_types::Wasm {

0 commit comments

Comments
 (0)