Skip to content

feat: implemented TranslateBrowsePathsToNodeIds service#309

Open
nmammeri wants to merge 3 commits intoHMIProject:mainfrom
nmammeri:feat/add-translate-browse-path-service
Open

feat: implemented TranslateBrowsePathsToNodeIds service#309
nmammeri wants to merge 3 commits intoHMIProject:mainfrom
nmammeri:feat/add-translate-browse-path-service

Conversation

@nmammeri
Copy link

No description provided.

@uklotzde
Copy link
Collaborator

Thanks for contributing!

Sorry for letting you wait. Holidays and higher priority product work delayed the review of your PR. We'll take a look.

Copy link
Collaborator

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only some minor remarks from my side.

impl TranslateBrowsePathsToNodeIdsResponse {
#[must_use]
pub fn results(&self) -> Option<ua::Array<ua::BrowsePathResult>> {
ua::Array::from_raw_parts(self.0.resultsSize, self.0.results)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the TODO comments about returning "non-owned" results from similar methods. Just for consistency.

/// # Errors
/// This fails only when the entire request fails. When a path does not exist or cannot be
/// translated, an inner `Err` is returned.
pub async fn translate_browse_path(
Copy link
Collaborator

@uklotzde uklotzde Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a convenience method for very simple use cases.

We should strive to reduce the amount of redundant code by calling self.translate_many_browse_paths(). Even if it has a minor performance overhead.

See also: read_attributes()/read_many_attributes()

return Err(Error::internal("unexpected number of browse path results"));
}

let targets: Vec<_> = results.iter().map(to_browse_path_result).collect();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the turbofish variant here. See also: #312

}
}

// translate many browse paths
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use sentence-style line comments for consistency and readability. Starting with a capital letter and ending with a period. Even if the comment is not a complete sentence.

@uklotzde
Copy link
Collaborator

We also need a changelog entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants