real-logic / artio

Artio - Resilient High-Performance FIX and FIXP Gateway
Apache License 2.0
300 stars 121 forks source link

header field in FollowerSessionRequest will cause duplicate definitions when generated codec for rust #522

Open rafalpiotrowski opened 1 month ago

rafalpiotrowski commented 1 month ago

sbe generator targeting rust language will generate two functions with name "header"

generated from artio-codecs/src/main/resources/uk/co/real_logic/artio/messages/message-schema.xml

impl<'a> FollowerSessionRequestEncoder<'a> {
...
       pub fn header(self, offset: usize) -> MessageHeaderEncoder<Self> {
            let mut header = MessageHeaderEncoder::default().wrap(self, offset);
            header.block_length(SBE_BLOCK_LENGTH);
            header.template_id(SBE_TEMPLATE_ID);
            header.schema_id(SBE_SCHEMA_ID);
            header.version(SBE_SCHEMA_VERSION);
            header
        }
...
        #[inline]
        pub fn header(&mut self, value: &[u8]) {
            let limit = self.get_limit();
            let data_length = value.len();
            self.set_limit(limit + 4 + data_length);
            self.get_buf_mut().put_u32_at(limit, data_length as u32);
            self.get_buf_mut().put_slice_at(limit + 4, value);
        }
...