Function translate

Source
pub fn translate(_: TranslateParams) -> FnResult<TranslationResult>
Expand description

Gets called once for every value of every signal being rendered, and returns the corresponding translated value.

For non-hierarchical values, returning

Ok(TranslationResult {
    val: surfer_translation_types::ValueRepr::String(/* value here */),
    kind: ValueKind::Normal,
    subfields: vec![],
})

works, for hierarchical values, see [TranslationResult]

It is often helpful to destructure the params like this to not have to perform field access on the values

pub fn translate(
    TranslateParams { variable, value }: TranslateParams,
) -> FnResult<TranslationResult> {}