eclipse-iceoryx / eclipse-iceoryx/iceoryx2
Runtime Fixed Size Types (Dynamic Types) support
- Dominant language
- Rust
- Stars
- 2.5k
- Forks
- 185
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 32
Description
## Brief feature description
Currently, iceoryx2 only supports transmission types with a compile time fixed size. There are already types available that support having a fixed size at runtime, but the end user API does not provide an interface to create structs containing them.
The idea would be to introduce a trait to support runtime fixed size types.
```rust
pub trait RuntimeFixedSizeTypeConfig {}
pub trait RuntimeFixedSizeType {
type Config: RuntimeFixedSizeTypeConfig;
fn required_memory_size(config: Self::Config) -> usize;
fn init(&self, allocator: ShmAllocator);
}
```
The user would implement the trait and could use it like:
```rust
let service = zero_copy::Service::new(&service_name)
.publish_subscribe()
.open_or_create::()?;
let publisher = service.publisher()
.max_dynamic_type_size(1024)
.create()?;
let sample = publisher.loan_uninit(my_dynamic_type_config)?;
sample.write_payload(...);
sample.send();
```
Contributor guide
Assessment
This issue has not been assessed yet.