pub struct CodecRegistry { /* private fields */ }Expand description
Registry of vendor name → (codec factory, type parser).
can-motor-control ships empty by default — populating “damiao” lives in
the can-motor-damiao-codec package (or in a higher-level binding crate).
The Python binding (can-motor-control-py) registers damiao automatically;
Rust users either build a registry themselves or use the helper exposed by
their vendor codec crate.
Implementations§
Source§impl CodecRegistry
impl CodecRegistry
Sourcepub fn register(
&mut self,
name: impl Into<String>,
factory: impl Fn() -> Box<dyn MotorCodec> + Send + Sync + 'static,
parser: impl Fn(&str) -> Option<MotorTypeId> + Send + Sync + 'static,
) -> &mut Self
pub fn register( &mut self, name: impl Into<String>, factory: impl Fn() -> Box<dyn MotorCodec> + Send + Sync + 'static, parser: impl Fn(&str) -> Option<MotorTypeId> + Send + Sync + 'static, ) -> &mut Self
Register a vendor codec + its type-string parser.
Sourcepub fn vendor_names(&self) -> impl Iterator<Item = &str>
pub fn vendor_names(&self) -> impl Iterator<Item = &str>
Names of every registered vendor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodecRegistry
impl !RefUnwindSafe for CodecRegistry
impl Send for CodecRegistry
impl Sync for CodecRegistry
impl Unpin for CodecRegistry
impl UnsafeUnpin for CodecRegistry
impl !UnwindSafe for CodecRegistry
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