harbor run -t openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-6819harbor download openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-6819Task Description: Implement a ParameterManager in Rust
You are required to implement a ParameterManager struct in Rust, which will manage parameters for a ROS2 node. This manager should be able to retrieve, set, and delete parameters from the node's parameter map. The specifics of this implementation are as follows:
Struct Definition: Create a struct called ParameterManager with the following fields:
Node which will allow access to the node's parameters.Functionality:
ParameterManager:
new(node: &mut Node) -> Self: Constructs a new ParameterManager that takes a mutable reference to a Node.get_parameter(&self, key: &str) -> Result<ParameterValue>: Retrieves the value of the specified parameter. It should return a Result containing ParameterValue or an error if the parameter does not exist.set_parameter(&mut self, key: String, value: ParameterValue) -> Result<()>: Sets the value of a parameter. If the parameter exists, it updates it; if not, it creates a new entry. This should return a Result indicating success or failure.delete_parameter(&mut self, key: &str) -> Result<()>: Deletes the specified parameter from the node's parameter map, returning a Result for success or failure.Error Handling: Utilize the custom Error type defined in the original code when handling any errors within the ParameterManager methods.
Tests: Write unit tests in a new module integrated with the original test suite to validate the functionality of your ParameterManager. Ensure that the tests cover:
Documentation: Add comments to your code explaining the purpose of each method and any important implementation details.
Place your implementation in the /app/ directory. Ensure to follow Rust's best practices for safety and performance while writing code, especially when handling mutable states and references.