Introduce length functor (#314)

This commit is contained in:
Mike Voronov
2022-09-08 16:58:04 +03:00
committed by GitHub
parent 626796b299
commit a4011ef038
56 changed files with 1411 additions and 683 deletions

View File

@ -18,6 +18,7 @@ use super::{Call, Sexp};
use crate::{asserts::ServiceDefinition, ephemeral::PeerId};
use std::collections::{HashMap, HashSet};
use std::fmt::Write;
#[derive(Debug, Default)]
pub(crate) struct Transformer {
@ -57,7 +58,9 @@ impl Transformer {
self.results.insert(call_id, service.clone());
match &mut call.triplet.1 {
Sexp::String(ref mut value) => value.push_str(&format!("..{}", call_id)),
Sexp::String(ref mut value) => {
write!(value, "..{}", call_id).unwrap();
}
_ => panic!("Incorrect script: non-string service string not supported"),
}
}