Skip to content

feat: implemented TranslateBrowsePathsToNodeIds service#309

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

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

Conversation

@nmammeri

Copy link
Copy Markdown

No description provided.

@uklotzde

Copy link
Copy Markdown
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.

@uklotzde uklotzde left a comment

Copy link
Copy Markdown
Collaborator

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
Copy Markdown
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.

Comment thread src/async_client.rs
/// # 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(

@uklotzde uklotzde Jan 12, 2026

Copy link
Copy Markdown
Collaborator

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()

Comment thread src/async_client.rs
return Err(Error::internal("unexpected number of browse path results"));
}

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

We also need a changelog entry.

@uklotzde uklotzde added this to the v0.11.0 milestone Mar 28, 2026
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