#[repr(C)]pub struct SequenceRaw<T> {
pub data: *mut T,
pub size: usize,
pub capacity: usize,
}Expand description
Raw sequence type for FFI compatibility
This represents a dynamically-sized sequence of elements as used in ROS2 C API.
§Memory Management
- With
rclfeature: Memory is managed by ROS2 C libraries through FFI. UseTryClonefor proper copying via FFI functions. - Without
rclfeature: Memory can be managed by Rust usingfrom_vec(). The sequence takes ownership and will free memory on drop.
Fields§
§data: *mut TPointer to the data array
size: usizeCurrent number of elements
capacity: usizeAllocated capacity
Implementations§
Source§impl<T> SequenceRaw<T>
impl<T> SequenceRaw<T>
Sourcepub const fn null() -> SequenceRaw<T>
pub const fn null() -> SequenceRaw<T>
Create a null/empty sequence
pub fn iter(&self) -> Iter<'_, T>
Sourcepub fn as_slice_mut(&mut self) -> &mut [T]
👎Deprecated: use as_mut_slice instead
pub fn as_slice_mut(&mut self) -> &mut [T]
use as_mut_slice instead
Get a mutable slice of the sequence data
Sourcepub fn as_mut_slice(&mut self) -> &mut [T]
pub fn as_mut_slice(&mut self) -> &mut [T]
Get a mutable slice of the sequence data
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Source§impl<T> SequenceRaw<T>
impl<T> SequenceRaw<T>
Sourcepub fn from_vec(vec: Vec<T>) -> SequenceRaw<T>
pub fn from_vec(vec: Vec<T>) -> SequenceRaw<T>
Create a sequence from a Vec (takes ownership)
The Vec’s memory is transferred to the sequence. The sequence will free the memory when dropped.
Trait Implementations§
Source§impl<T> Clone for SequenceRaw<T>where
T: Clone,
Available on non-crate feature rcl only.
impl<T> Clone for SequenceRaw<T>where
T: Clone,
Available on non-crate feature
rcl only.Source§fn clone(&self) -> SequenceRaw<T>
fn clone(&self) -> SequenceRaw<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T> Debug for SequenceRaw<T>where
T: Debug,
impl<T> Debug for SequenceRaw<T>where
T: Debug,
Source§impl<T> Default for SequenceRaw<T>
impl<T> Default for SequenceRaw<T>
Source§fn default() -> SequenceRaw<T>
fn default() -> SequenceRaw<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for SequenceRaw<T>where
T: Deserialize<'de>,
Available on non-crate feature rcl only.
impl<'de, T> Deserialize<'de> for SequenceRaw<T>where
T: Deserialize<'de>,
Available on non-crate feature
rcl only.Source§fn deserialize<D>(
deserializer: D,
) -> Result<SequenceRaw<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<SequenceRaw<T>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Drop for SequenceRaw<T>
Available on non-crate feature rcl only.
impl<T> Drop for SequenceRaw<T>
Available on non-crate feature
rcl only.Source§impl<T> PartialEq for SequenceRaw<T>where
T: PartialEq,
impl<T> PartialEq for SequenceRaw<T>where
T: PartialEq,
Source§impl<T> Serialize for SequenceRaw<T>where
T: Serialize,
Available on non-crate feature rcl only.
impl<T> Serialize for SequenceRaw<T>where
T: Serialize,
Available on non-crate feature
rcl only.Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T> Send for SequenceRaw<T>where
T: Send,
impl<T> Sync for SequenceRaw<T>where
T: Sync,
Auto Trait Implementations§
impl<T> Freeze for SequenceRaw<T>
impl<T> RefUnwindSafe for SequenceRaw<T>where
T: RefUnwindSafe,
impl<T> Unpin for SequenceRaw<T>
impl<T> UnsafeUnpin for SequenceRaw<T>
impl<T> UnwindSafe for SequenceRaw<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more