Skip to content

Commit 68d4026

Browse files
authored
[export] Add Option to struct (#106)
1 parent 5141ba3 commit 68d4026

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/types.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,22 +370,28 @@ pub struct SymbolicShapeSpecializationMetadata {
370370

371371
#[derive(Debug, Deserialize, Serialize, Default)]
372372
pub struct FrameLocals {
373-
pub locals: Option<FxHashMap<String, String>>,
374-
pub symbols: Option<FxHashMap<String, String>>,
373+
pub locals: Option<FxHashMap<String, Option<String>>>,
374+
pub symbols: Option<FxHashMap<String, Option<String>>>,
375375
}
376376
impl Display for FrameLocals {
377377
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
378378
if let Some(locals) = &self.locals {
379379
write!(f, "Locals:<pre>\n")?;
380380
for (name, value) in locals {
381-
write!(f, " {}: {}\n", name, value)?;
381+
match value {
382+
Some(v) => write!(f, " {}: {}\n", name, v),
383+
None => Ok(()),
384+
}?
382385
}
383386
write!(f, "</pre>")?;
384387
}
385388
if let Some(symbols) = &self.symbols {
386389
write!(f, "Symbols:<pre>\n")?;
387390
for (name, value) in symbols {
388-
write!(f, " {}: {}\n", name, value)?;
391+
match value {
392+
Some(v) => write!(f, " {}: {}\n", name, v),
393+
None => Ok(()),
394+
}?
389395
}
390396
write!(f, "</pre>")?;
391397
}

0 commit comments

Comments
 (0)