ProvidesSubObjects

Trait ProvidesSubObjects 

Source
pub trait ProvidesSubObjects {
    // Required methods
    fn get_sub_object(&self, sub: u8) -> Option<(SubInfo, &dyn SubObjectAccess)>;
    fn object_code(&self) -> ObjectCode;

    // Provided method
    fn flags(&self) -> Option<&dyn ObjectFlagAccess> { ... }
}
Expand description

A trait for structs which represent Objects to implement

Implementing this type allows a type sub object which implements SubObjectAccess to implement ObjectAccess simply by implementing this trait to provide a sub object for each sub index.

Required Methods§

Source

fn get_sub_object(&self, sub: u8) -> Option<(SubInfo, &dyn SubObjectAccess)>

Get a sub object by index

This is used for objects which have a fixed number of sub objects, such as arrays or records.

It should return None if the sub object does not exist, and when it does exist it returns a tuple containing a SubInfo with metadata about the sub object, and &dyn SubObjectAccess which provides read/write access to the sub object data.

Source

fn object_code(&self) -> ObjectCode

What type of object is this

Provided Methods§

Source

fn flags(&self) -> Option<&dyn ObjectFlagAccess>

Get the object flags for this object

Notification flags are supported by some objects to indicate changes made in the object by the application – for example, to trigger the transmission of a mapped PDO.

If the object supports flags, it should override this method to return a reference to them

Implementors§

Source§

impl ProvidesSubObjects for PdoCommObject

Source§

impl<const APP: bool, const NUM_SECTIONS: u8> ProvidesSubObjects for BootloaderInfo<APP, NUM_SECTIONS>