Skip to content

Commit 9fdedc4

Browse files
luca-della-vedovamxgreyjhdcs
authored andcommitted
Add parameter services (#342)
* WIP Adding describe paramater service * Implement parameter setting services Signed-off-by: Luca Della Vedova <[email protected]> * Restructure and cleanup Signed-off-by: Luca Della Vedova <[email protected]> * Implement list_parameters with prefixes Signed-off-by: Luca Della Vedova <[email protected]> * Minor cleanups Signed-off-by: Luca Della Vedova <[email protected]> * Fix tests, cleanups Signed-off-by: Luca Della Vedova <[email protected]> * Fix order of drop calls Signed-off-by: Luca Della Vedova <[email protected]> * Add first bunch of unit tests for list and get / set parameters Signed-off-by: Luca Della Vedova <[email protected]> * Clear warnings in rclrs Signed-off-by: Luca Della Vedova <[email protected]> * Fix clippy, add set atomically tests Signed-off-by: Luca Della Vedova <[email protected]> * Add describe parameter and get parameter types tests Signed-off-by: Luca Della Vedova <[email protected]> * Minor cleanups, remove several unwraps Signed-off-by: Luca Della Vedova <[email protected]> * Remove commented code Signed-off-by: Luca Della Vedova <[email protected]> * Address first round of feedback Signed-off-by: Luca Della Vedova <[email protected]> * Allow undeclared parameters in parameter getting services Signed-off-by: Luca Della Vedova <[email protected]> * Clippy Signed-off-by: Luca Della Vedova <[email protected]> * Run rustfmt Signed-off-by: Michael X. Grey <[email protected]> * Update rclrs/src/parameter/service.rs Co-authored-by: jhdcs <[email protected]> * Change behavior to return NOT_SET for non existing parameters Signed-off-by: Luca Della Vedova <[email protected]> * Make use_sim_time parameter read only Signed-off-by: Luca Della Vedova <[email protected]> * Format Signed-off-by: Luca Della Vedova <[email protected]> * Add a comment to denote why unwrap is safe Signed-off-by: Luca Della Vedova <[email protected]> * Use main fmt Signed-off-by: Luca Della Vedova <[email protected]> * Add a builder parameter to start parameter services Signed-off-by: Luca Della Vedova <[email protected]> --------- Signed-off-by: Luca Della Vedova <[email protected]> Signed-off-by: Michael X. Grey <[email protected]> Co-authored-by: Michael X. Grey <[email protected]> Co-authored-by: jhdcs <[email protected]>
1 parent 3cb1e9b commit 9fdedc4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rosidl_runtime_rs/src/string.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::{
2+
borrow::Borrow,
23
cmp::Ordering,
34
ffi::CStr,
45
fmt::{self, Debug, Display},
@@ -302,13 +303,17 @@ string_impl!(
302303
rosidl_runtime_c__U16String__Sequence__copy
303304
);
304305

305-
impl From<&str> for String {
306-
fn from(s: &str) -> Self {
306+
impl<T> From<T> for String
307+
where
308+
T: Borrow<str>,
309+
{
310+
fn from(s: T) -> Self {
307311
let mut msg = Self {
308312
data: std::ptr::null_mut(),
309313
size: 0,
310314
capacity: 0,
311315
};
316+
let s = s.borrow();
312317
// SAFETY: It's okay to pass a non-zero-terminated string here since assignn uses the
313318
// specified length and will append the 0 byte to the dest string itself.
314319
if !unsafe {

0 commit comments

Comments
 (0)