rustorb-dds 0.2.0

DDS (Data Distribution Service) DCPS API in Rust
Documentation
// Generated by rustorb-idl from EvolveV1.idl. Do not edit.
//
// This file is not covered by the license of rustorb-idl.

const _: () = ::rustorb_typesupport::GENERATED_CODE_VERSION_1;

pub mod evolve {
    /// IDL struct `Evolve::Appendable`.
    #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
    pub struct Appendable {
        pub number: i32,
        pub text: ::std::string::String,
    }

    impl Appendable {
        pub const REPOSITORY_ID: &'static str = "IDL:Evolve/Appendable:1.0";
    }

    impl ::rustorb_typesupport::TypeSupport for Appendable {
        type Rust = Appendable;

        fn write(
            v: &Appendable,
            enc: &mut ::rustorb_typesupport::Encoder,
        ) -> ::rustorb_typesupport::Result<()> {
            let s = ::rustorb_typesupport::aggregate::begin(
                enc,
                ::rustorb_typesupport::Extensibility::Appendable,
            );
            <i32 as ::rustorb_typesupport::TypeSupport>::write(&v.number, enc)?;
            <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::write(
                &v.text, enc,
            )?;
            ::rustorb_typesupport::aggregate::end(enc, s)
        }

        fn read(
            dec: &mut ::rustorb_typesupport::Decoder<'_>,
        ) -> ::rustorb_typesupport::Result<Appendable> {
            let s = ::rustorb_typesupport::aggregate::begin_read(
                dec,
                ::rustorb_typesupport::Extensibility::Appendable,
            )?;
            let v = Appendable {
                number: if ::rustorb_typesupport::aggregate::has_more(dec, &s) {
                    <i32 as ::rustorb_typesupport::TypeSupport>::read(dec)?
                } else {
                    Default::default()
                },
                text: if ::rustorb_typesupport::aggregate::has_more(dec, &s) {
                    <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::read(dec)?
                } else {
                    Default::default()
                },
            };
            ::rustorb_typesupport::aggregate::end_read(dec, s)?;
            Ok(v)
        }

        fn write_key(
            v: &Appendable,
            enc: &mut ::rustorb_typesupport::Encoder,
        ) -> ::rustorb_typesupport::Result<()> {
            <i32 as ::rustorb_typesupport::TypeSupport>::write_key(&v.number, enc)?;
            <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::write_key(
                &v.text, enc,
            )?;
            Ok(())
        }

        fn max_key_end(offset: usize) -> Option<usize> {
            let offset = <i32 as ::rustorb_typesupport::TypeSupport>::max_key_end(offset)?;
            let offset =
                <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::max_key_end(
                    offset,
                )?;
            Some(offset)
        }
    }

    impl ::rustorb_typesupport::TopicType for Appendable {
        const TYPE_NAME: &'static str = "Evolve::Appendable";
        const EXTENSIBILITY: ::rustorb_typesupport::Extensibility =
            ::rustorb_typesupport::Extensibility::Appendable;
        const KEYED: bool = false;
    }

    impl ::rustorb_xtypes::types::DescribeType for Appendable {
        fn describe_type() -> ::rustorb_xtypes::types::Type {
            static TYPE: ::std::sync::OnceLock<::rustorb_xtypes::types::Type> =
                ::std::sync::OnceLock::new();
            TYPE.get_or_init(|| {
                ::rustorb_xtypes::types::Type::from(::rustorb_xtypes::types::StructType {
                    name: "Evolve::Appendable".into(),
                    extensibility: ::rustorb_xtypes::types::Extensibility::Appendable,
                    nested: false,
                    autoid_hash: false,
                    base: None,
                    members: vec![
                        ::rustorb_xtypes::types::StructMember {
                            key: false,
                            optional: false,
                            must_understand: false,
                            external: false,
                            ..::rustorb_xtypes::types::StructMember::new(
                                "number",
                                0,
                                ::rustorb_xtypes::types::Type::Primitive(
                                    ::rustorb_xtypes::types::Primitive::Int32,
                                ),
                            )
                        },
                        ::rustorb_xtypes::types::StructMember {
                            key: false,
                            optional: false,
                            must_understand: false,
                            external: false,
                            ..::rustorb_xtypes::types::StructMember::new(
                                "text",
                                1,
                                ::rustorb_xtypes::types::Type::String {
                                    wide: false,
                                    bound: 0,
                                },
                            )
                        },
                    ],
                })
            })
            .clone()
        }
    }

    /// IDL struct `Evolve::Mutable`.
    #[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
    pub struct Mutable {
        pub number: i32,
        pub text: ::std::string::String,
    }

    impl Mutable {
        pub const REPOSITORY_ID: &'static str = "IDL:Evolve/Mutable:1.0";
    }

    impl ::rustorb_typesupport::TypeSupport for Mutable {
        type Rust = Mutable;

        fn write(
            v: &Mutable,
            enc: &mut ::rustorb_typesupport::Encoder,
        ) -> ::rustorb_typesupport::Result<()> {
            let s = ::rustorb_typesupport::aggregate::begin(
                enc,
                ::rustorb_typesupport::Extensibility::Mutable,
            );
            ::rustorb_typesupport::aggregate::write_member::<i32>(&v.number, 1, false, enc)?;
            ::rustorb_typesupport::aggregate::write_member::<::rustorb_typesupport::Str>(
                &v.text, 2, false, enc,
            )?;
            ::rustorb_typesupport::aggregate::end(enc, s)
        }

        fn read(
            dec: &mut ::rustorb_typesupport::Decoder<'_>,
        ) -> ::rustorb_typesupport::Result<Mutable> {
            let s = ::rustorb_typesupport::aggregate::begin_read(
                dec,
                ::rustorb_typesupport::Extensibility::Mutable,
            )?;
            let mut m_number = None;
            let mut m_text = None;
            while let Some(m) = ::rustorb_typesupport::aggregate::next_member(dec, &s)? {
                match m.id() {
                    1 => m_number = Some(<i32 as ::rustorb_typesupport::TypeSupport>::read(dec)?),
                    2 => m_text = Some(
                        <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::read(
                            dec,
                        )?,
                    ),
                    _ => m.unknown()?,
                }
                ::rustorb_typesupport::aggregate::end_member(dec, m)?;
            }
            ::rustorb_typesupport::aggregate::end_read(dec, s)?;
            Ok(Mutable {
                number: m_number.unwrap_or_default(),
                text: m_text.unwrap_or_default(),
            })
        }

        fn write_key(
            v: &Mutable,
            enc: &mut ::rustorb_typesupport::Encoder,
        ) -> ::rustorb_typesupport::Result<()> {
            <i32 as ::rustorb_typesupport::TypeSupport>::write_key(&v.number, enc)?;
            <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::write_key(
                &v.text, enc,
            )?;
            Ok(())
        }

        fn max_key_end(offset: usize) -> Option<usize> {
            let offset = <i32 as ::rustorb_typesupport::TypeSupport>::max_key_end(offset)?;
            let offset =
                <::rustorb_typesupport::Str as ::rustorb_typesupport::TypeSupport>::max_key_end(
                    offset,
                )?;
            Some(offset)
        }
    }

    impl ::rustorb_typesupport::TopicType for Mutable {
        const TYPE_NAME: &'static str = "Evolve::Mutable";
        const EXTENSIBILITY: ::rustorb_typesupport::Extensibility =
            ::rustorb_typesupport::Extensibility::Mutable;
        const KEYED: bool = false;
    }

    impl ::rustorb_xtypes::types::DescribeType for Mutable {
        fn describe_type() -> ::rustorb_xtypes::types::Type {
            static TYPE: ::std::sync::OnceLock<::rustorb_xtypes::types::Type> =
                ::std::sync::OnceLock::new();
            TYPE.get_or_init(|| {
                ::rustorb_xtypes::types::Type::from(::rustorb_xtypes::types::StructType {
                    name: "Evolve::Mutable".into(),
                    extensibility: ::rustorb_xtypes::types::Extensibility::Mutable,
                    nested: false,
                    autoid_hash: false,
                    base: None,
                    members: vec![
                        ::rustorb_xtypes::types::StructMember {
                            key: false,
                            optional: false,
                            must_understand: false,
                            external: false,
                            ..::rustorb_xtypes::types::StructMember::new(
                                "number",
                                1,
                                ::rustorb_xtypes::types::Type::Primitive(
                                    ::rustorb_xtypes::types::Primitive::Int32,
                                ),
                            )
                        },
                        ::rustorb_xtypes::types::StructMember {
                            key: false,
                            optional: false,
                            must_understand: false,
                            external: false,
                            ..::rustorb_xtypes::types::StructMember::new(
                                "text",
                                2,
                                ::rustorb_xtypes::types::Type::String {
                                    wide: false,
                                    bound: 0,
                                },
                            )
                        },
                    ],
                })
            })
            .clone()
        }
    }
}