Skip to content

Commit c0f2251

Browse files
committed
Removed RclFuture and supporting functions
1 parent a988c45 commit c0f2251

File tree

3 files changed

+0
-115
lines changed

3 files changed

+0
-115
lines changed

rclrs/src/future.rs

Lines changed: 0 additions & 63 deletions
This file was deleted.

rclrs/src/lib.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -112,54 +112,3 @@ pub fn spin(node: &Node) -> Result<(), RclrsError> {
112112
}
113113
Ok(())
114114
}
115-
116-
/// Convenience function for calling [`rclrs::spin_once`] in a loop.
117-
///
118-
/// This function additionally checks that the context is still valid.
119-
pub fn spin_some(node: &Node) -> Result<(), RclrsError> {
120-
// The context_is_valid functions exists only to abstract away ROS distro differences
121-
#[cfg(ros_distro = "foxy")]
122-
// SAFETY: No preconditions for this function.
123-
let context_is_valid = || unsafe { rcl_context_is_valid(&mut *node.context.lock()) };
124-
#[cfg(not(ros_distro = "foxy"))]
125-
// SAFETY: No preconditions for this function.
126-
let context_is_valid = || unsafe { rcl_context_is_valid(&*node.context.lock()) };
127-
128-
if context_is_valid() {
129-
if let Some(error) = spin_once(node, Some(std::time::Duration::from_millis(500))).err() {
130-
match error.code {
131-
RclReturnCode::Timeout => (),
132-
_ => return Err(error),
133-
}
134-
}
135-
}
136-
Ok(())
137-
}
138-
139-
pub fn spin_until_future_complete<T: Unpin + Clone>(
140-
node: &node::Node,
141-
future: Arc<Mutex<Box<crate::future::RclFuture<T>>>>,
142-
) -> Result<<future::RclFuture<T> as Future>::Output, RclrsError> {
143-
let rclwaker = Arc::new(crate::future::RclWaker {});
144-
let waker = crate::future::rclwaker_into_waker(Arc::into_raw(rclwaker));
145-
let mut cx = std::task::Context::from_waker(&waker);
146-
147-
loop {
148-
let context_valid = unsafe { rcl_context_is_valid(&mut *node.context.lock()) };
149-
if context_valid {
150-
if let Some(error) = spin_once(node, None).err() {
151-
match error {
152-
RclrsError {
153-
code: RclReturnCode::Timeout,
154-
..
155-
} => continue,
156-
error => return Err(error),
157-
};
158-
};
159-
match Future::poll(Pin::new(&mut *future.lock()), &mut cx) {
160-
Poll::Ready(val) => break Ok(val),
161-
Poll::Pending => continue,
162-
};
163-
}
164-
}
165-
}

rclrs/src/node/client.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use std::sync::atomic::{AtomicI64, Ordering};
99
use std::sync::Arc;
1010

1111
use crate::error::{RclReturnCode, ToResult};
12-
use crate::future::RclFuture;
1312
use crate::MessageCow;
1413
use crate::Node;
1514
use crate::{rcl_bindings::*, RclrsError};

0 commit comments

Comments
 (0)