Skip to main content

SequenceRaw

Struct SequenceRaw 

Source
#[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 rcl feature: Memory is managed by ROS2 C libraries through FFI. Use TryClone for proper copying via FFI functions.
  • Without rcl feature: Memory can be managed by Rust using from_vec(). The sequence takes ownership and will free memory on drop.

Fields§

§data: *mut T

Pointer to the data array

§size: usize

Current number of elements

§capacity: usize

Allocated capacity

Implementations§

Source§

impl<T> SequenceRaw<T>

Source

pub const fn null() -> Self

Create a null/empty sequence

Source

pub fn is_empty(&self) -> bool

Check if the sequence is empty

Source

pub fn len(&self) -> usize

Get the length of the sequence

Source

pub fn as_slice(&self) -> &[T]

Get a slice of the sequence data

Source

pub fn iter(&self) -> Iter<'_, T>

Source

pub fn as_slice_mut(&mut self) -> &mut [T]

👎Deprecated:

use as_mut_slice instead

Get a mutable slice of the sequence data

Source

pub fn as_mut_slice(&mut self) -> &mut [T]

Get a mutable slice of the sequence data

Source

pub fn iter_mut(&mut self) -> IterMut<'_, T>

Source§

impl<T> SequenceRaw<T>

Source

pub fn from_vec(vec: Vec<T>) -> Self

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.

Source

pub unsafe fn into_vec(self) -> Vec<T>

Convert the sequence back to a Vec (takes ownership)

§Safety

Only call this on sequences created with from_vec() or that you know were allocated by Rust.

Trait Implementations§

Source§

impl<T: Clone> Clone for SequenceRaw<T>

Available on non-crate feature rcl only.
Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for SequenceRaw<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for SequenceRaw<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, T: Deserialize<'de>> Deserialize<'de> for SequenceRaw<T>

Available on non-crate feature rcl only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::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.
Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T: PartialEq> PartialEq for SequenceRaw<T>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: Serialize> Serialize for SequenceRaw<T>

Available on non-crate feature rcl only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Send> Send for SequenceRaw<T>

Source§

impl<T: Sync> Sync for SequenceRaw<T>

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CdrSerde for T

Source§

fn serialize(&self) -> Result<Vec<u8>, Error>

Serialize to CDR-encoded bytes with encapsulation header Read more
Source§

fn serialize_with_header( &self, header: CdrEncapsulationHeader, ) -> Result<Vec<u8>, Error>

Serialize with a specific encapsulation header
Source§

fn deserialize(bytes: &[u8]) -> Result<T, Error>

Deserialize from CDR-encoded bytes Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,