diff --git a/node/src/DataConsumer.ts b/node/src/DataConsumer.ts index 9d257ab7b5..17a41dd41d 100644 --- a/node/src/DataConsumer.ts +++ b/node/src/DataConsumer.ts @@ -517,23 +517,14 @@ export class DataConsumer if (typeof message === 'string') { - const messageOffset = builder.createString(message); - - dataOffset = FbsDataConsumer.String.createString(builder, messageOffset); + message = Buffer.from(message); } - else - { - const messageOffset = FbsDataConsumer.Binary.createValueVector(builder, message); - dataOffset = FbsDataConsumer.Binary.createBinary(builder, messageOffset); - } + dataOffset = FbsDataConsumer.SendRequest.createDataVector(builder, message); const requestOffset = FbsDataConsumer.SendRequest.createSendRequest( builder, ppid, - typeof message === 'string' ? - FbsDataConsumer.Data.String : - FbsDataConsumer.Data.Binary, dataOffset ); diff --git a/node/src/DataProducer.ts b/node/src/DataProducer.ts index 43f48a09bd..26fc8efd81 100644 --- a/node/src/DataProducer.ts +++ b/node/src/DataProducer.ts @@ -442,23 +442,14 @@ export class DataProducer if (typeof message === 'string') { - const messageOffset = builder.createString(message); - - dataOffset = FbsDataProducer.String.createString(builder, messageOffset); + message = Buffer.from(message); } - else - { - const messageOffset = FbsDataProducer.Binary.createValueVector(builder, message); - dataOffset = FbsDataProducer.Binary.createBinary(builder, messageOffset); - } + dataOffset = FbsDataProducer.SendNotification.createDataVector(builder, message); const notificationOffset = FbsDataProducer.SendNotification.createSendNotification( builder, ppid, - typeof message === 'string' ? - FbsDataProducer.Data.String : - FbsDataProducer.Data.Binary, dataOffset, subchannelsOffset, requiredSubchannel ?? null diff --git a/rust/src/fbs.rs b/rust/src/fbs.rs index e883f180e0..3438014f03 100644 --- a/rust/src/fbs.rs +++ b/rust/src/fbs.rs @@ -25333,10 +25333,10 @@ mod root { } } - /// The table `String` in the namespace `FBS.DataConsumer` + /// The table `SendRequest` in the namespace `FBS.DataConsumer` /// /// Generated from these locations: - /// * Table `String` in the file `../worker/fbs/dataConsumer.fbs:37` + /// * Table `SendRequest` in the file `../worker/fbs/dataConsumer.fbs:37` #[derive( Clone, Debug, @@ -25348,163 +25348,226 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub struct String { - /// The field `value` in the table `String` - pub value: ::planus::alloc::string::String, + pub struct SendRequest { + /// The field `ppid` in the table `SendRequest` + pub ppid: u32, + /// The field `data` in the table `SendRequest` + pub data: ::planus::alloc::vec::Vec, } - impl String { - /// Creates a [StringBuilder] for serializing an instance of this table. + impl SendRequest { + /// Creates a [SendRequestBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> StringBuilder<()> { - StringBuilder(()) + pub fn builder() -> SendRequestBuilder<()> { + SendRequestBuilder(()) } #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - field_value: impl ::planus::WriteAs<::planus::Offset>, + field_ppid: impl ::planus::WriteAsDefault, + field_data: impl ::planus::WriteAs<::planus::Offset<[u8]>>, ) -> ::planus::Offset { - let prepared_value = field_value.prepare(builder); + let prepared_ppid = field_ppid.prepare(builder, &0); + let prepared_data = field_data.prepare(builder); - let mut table_writer: ::planus::table_writer::TableWriter<6> = + let mut table_writer: ::planus::table_writer::TableWriter<8> = ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset>(0); + if prepared_ppid.is_some() { + table_writer.write_entry::(0); + } + table_writer.write_entry::<::planus::Offset<[u8]>>(1); unsafe { table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_value); + if let ::core::option::Option::Some(prepared_ppid) = prepared_ppid { + object_writer.write::<_, _, 4>(&prepared_ppid); + } + object_writer.write::<_, _, 4>(&prepared_data); }); } builder.current_offset() } } - impl ::planus::WriteAs<::planus::Offset> for String { + impl ::planus::WriteAs<::planus::Offset> for SendRequest { type Prepared = ::planus::Offset; #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsOptional<::planus::Offset> for String { + impl ::planus::WriteAsOptional<::planus::Offset> for SendRequest { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOffset for String { + impl ::planus::WriteAsOffset for SendRequest { #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - String::create(builder, &self.value) + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { + SendRequest::create(builder, self.ppid, &self.data) } } - /// Builder for serializing an instance of the [String] type. + /// Builder for serializing an instance of the [SendRequest] type. /// - /// Can be created using the [String::builder] method. + /// Can be created using the [SendRequest::builder] method. #[derive(Debug)] #[must_use] - pub struct StringBuilder(State); + pub struct SendRequestBuilder(State); - impl StringBuilder<()> { - /// Setter for the [`value` field](String#structfield.value). + impl SendRequestBuilder<()> { + /// Setter for the [`ppid` field](SendRequest#structfield.ppid). #[inline] #[allow(clippy::type_complexity)] - pub fn value(self, value: T0) -> StringBuilder<(T0,)> + pub fn ppid(self, value: T0) -> SendRequestBuilder<(T0,)> where - T0: ::planus::WriteAs<::planus::Offset>, + T0: ::planus::WriteAsDefault, { - StringBuilder((value,)) + SendRequestBuilder((value,)) + } + + /// Sets the [`ppid` field](SendRequest#structfield.ppid) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn ppid_as_default(self) -> SendRequestBuilder<(::planus::DefaultValue,)> { + self.ppid(::planus::DefaultValue) } } - impl StringBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [String]. + impl SendRequestBuilder<(T0,)> { + /// Setter for the [`data` field](SendRequest#structfield.data). #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::Offset + #[allow(clippy::type_complexity)] + pub fn data(self, value: T1) -> SendRequestBuilder<(T0, T1)> where - Self: ::planus::WriteAsOffset, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + { + let (v0,) = self.0; + SendRequestBuilder((v0, value)) + } + } + + impl SendRequestBuilder<(T0, T1)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SendRequest]. + #[inline] + pub fn finish( + self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset + where + Self: ::planus::WriteAsOffset, { ::planus::WriteAsOffset::prepare(&self, builder) } } - impl>> - ::planus::WriteAs<::planus::Offset> for StringBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAs<::planus::Offset> + for SendRequestBuilder<(T0, T1)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl>> - ::planus::WriteAsOptional<::planus::Offset> for StringBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAsOptional<::planus::Offset> + for SendRequestBuilder<(T0, T1)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl>> ::planus::WriteAsOffset - for StringBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAsOffset for SendRequestBuilder<(T0, T1)> { #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - let (v0,) = &self.0; - String::create(builder, v0) + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { + let (v0, v1) = &self.0; + SendRequest::create(builder, v0, v1) } } - /// Reference to a deserialized [String]. + /// Reference to a deserialized [SendRequest]. #[derive(Copy, Clone)] - pub struct StringRef<'a>(::planus::table_reader::Table<'a>); + pub struct SendRequestRef<'a>(::planus::table_reader::Table<'a>); - impl<'a> StringRef<'a> { - /// Getter for the [`value` field](String#structfield.value). + impl<'a> SendRequestRef<'a> { + /// Getter for the [`ppid` field](SendRequest#structfield.ppid). #[inline] - pub fn value(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(0, "String", "value") + pub fn ppid(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0.access(0, "SendRequest", "ppid")?.unwrap_or(0), + ) + } + + /// Getter for the [`data` field](SendRequest#structfield.data). + #[inline] + pub fn data(&self) -> ::planus::Result<&'a [u8]> { + self.0.access_required(1, "SendRequest", "data") } } - impl<'a> ::core::fmt::Debug for StringRef<'a> { + impl<'a> ::core::fmt::Debug for SendRequestRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("StringRef"); - f.field("value", &self.value()); + let mut f = f.debug_struct("SendRequestRef"); + f.field("ppid", &self.ppid()); + f.field("data", &self.data()); f.finish() } } - impl<'a> ::core::convert::TryFrom> for String { + impl<'a> ::core::convert::TryFrom> for SendRequest { type Error = ::planus::Error; #[allow(unreachable_code)] - fn try_from(value: StringRef<'a>) -> ::planus::Result { + fn try_from(value: SendRequestRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - value: ::core::convert::TryInto::try_into(value.value()?)?, + ppid: ::core::convert::TryInto::try_into(value.ppid()?)?, + data: value.data()?.to_vec(), }) } } - impl<'a> ::planus::TableRead<'a> for StringRef<'a> { + impl<'a> ::planus::TableRead<'a> for SendRequestRef<'a> { #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, @@ -25516,7 +25579,7 @@ mod root { } } - impl<'a> ::planus::VectorReadInner<'a> for StringRef<'a> { + impl<'a> ::planus::VectorReadInner<'a> for SendRequestRef<'a> { type Error = ::planus::Error; const STRIDE: usize = 4; @@ -25526,7 +25589,7 @@ mod root { ) -> ::planus::Result { ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { error_kind.with_error_location( - "[StringRef]", + "[SendRequestRef]", "get", buffer.offset_from_start, ) @@ -25534,8 +25597,8 @@ mod root { } } - impl ::planus::VectorWrite<::planus::Offset> for String { - type Value = ::planus::Offset; + impl ::planus::VectorWrite<::planus::Offset> for SendRequest { + type Value = ::planus::Offset; const STRIDE: usize = 4; #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { @@ -25544,7 +25607,7 @@ mod root { #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[::planus::Offset], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { @@ -25559,7 +25622,7 @@ mod root { } } - impl<'a> ::planus::ReadAsRoot<'a> for StringRef<'a> { + impl<'a> ::planus::ReadAsRoot<'a> for SendRequestRef<'a> { fn read_as_root(slice: &'a [u8]) -> ::planus::Result { ::planus::TableRead::from_buffer( ::planus::SliceWithStartOffset { @@ -25569,15 +25632,15 @@ mod root { 0, ) .map_err(|error_kind| { - error_kind.with_error_location("[StringRef]", "read_as_root", 0) + error_kind.with_error_location("[SendRequestRef]", "read_as_root", 0) }) } } - /// The table `Binary` in the namespace `FBS.DataConsumer` + /// The table `SetSubchannelsRequest` in the namespace `FBS.DataConsumer` /// /// Generated from these locations: - /// * Table `Binary` in the file `../worker/fbs/dataConsumer.fbs:41` + /// * Table `SetSubchannelsRequest` in the file `../worker/fbs/dataConsumer.fbs:42` #[derive( Clone, Debug, @@ -25589,163 +25652,184 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub struct Binary { - /// The field `value` in the table `Binary` - pub value: ::planus::alloc::vec::Vec, + pub struct SetSubchannelsRequest { + /// The field `subchannels` in the table `SetSubchannelsRequest` + pub subchannels: ::planus::alloc::vec::Vec, } - impl Binary { - /// Creates a [BinaryBuilder] for serializing an instance of this table. + impl SetSubchannelsRequest { + /// Creates a [SetSubchannelsRequestBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> BinaryBuilder<()> { - BinaryBuilder(()) + pub fn builder() -> SetSubchannelsRequestBuilder<()> { + SetSubchannelsRequestBuilder(()) } #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - field_value: impl ::planus::WriteAs<::planus::Offset<[u8]>>, + field_subchannels: impl ::planus::WriteAs<::planus::Offset<[u16]>>, ) -> ::planus::Offset { - let prepared_value = field_value.prepare(builder); + let prepared_subchannels = field_subchannels.prepare(builder); let mut table_writer: ::planus::table_writer::TableWriter<6> = ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset<[u8]>>(0); + table_writer.write_entry::<::planus::Offset<[u16]>>(0); unsafe { table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_value); + object_writer.write::<_, _, 4>(&prepared_subchannels); }); } builder.current_offset() } } - impl ::planus::WriteAs<::planus::Offset> for Binary { + impl ::planus::WriteAs<::planus::Offset> for SetSubchannelsRequest { type Prepared = ::planus::Offset; #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsOptional<::planus::Offset> for Binary { + impl ::planus::WriteAsOptional<::planus::Offset> for SetSubchannelsRequest { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> + { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOffset for Binary { + impl ::planus::WriteAsOffset for SetSubchannelsRequest { #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - Binary::create(builder, &self.value) + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { + SetSubchannelsRequest::create(builder, &self.subchannels) } } - /// Builder for serializing an instance of the [Binary] type. + /// Builder for serializing an instance of the [SetSubchannelsRequest] type. /// - /// Can be created using the [Binary::builder] method. + /// Can be created using the [SetSubchannelsRequest::builder] method. #[derive(Debug)] #[must_use] - pub struct BinaryBuilder(State); + pub struct SetSubchannelsRequestBuilder(State); - impl BinaryBuilder<()> { - /// Setter for the [`value` field](Binary#structfield.value). + impl SetSubchannelsRequestBuilder<()> { + /// Setter for the [`subchannels` field](SetSubchannelsRequest#structfield.subchannels). #[inline] #[allow(clippy::type_complexity)] - pub fn value(self, value: T0) -> BinaryBuilder<(T0,)> + pub fn subchannels(self, value: T0) -> SetSubchannelsRequestBuilder<(T0,)> where - T0: ::planus::WriteAs<::planus::Offset<[u8]>>, + T0: ::planus::WriteAs<::planus::Offset<[u16]>>, { - BinaryBuilder((value,)) + SetSubchannelsRequestBuilder((value,)) } } - impl BinaryBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [Binary]. + impl SetSubchannelsRequestBuilder<(T0,)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SetSubchannelsRequest]. #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::Offset + pub fn finish( + self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset where - Self: ::planus::WriteAsOffset, + Self: ::planus::WriteAsOffset, { ::planus::WriteAsOffset::prepare(&self, builder) } } - impl>> - ::planus::WriteAs<::planus::Offset> for BinaryBuilder<(T0,)> + impl>> + ::planus::WriteAs<::planus::Offset> + for SetSubchannelsRequestBuilder<(T0,)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl>> - ::planus::WriteAsOptional<::planus::Offset> for BinaryBuilder<(T0,)> + impl>> + ::planus::WriteAsOptional<::planus::Offset> + for SetSubchannelsRequestBuilder<(T0,)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> + { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl>> ::planus::WriteAsOffset - for BinaryBuilder<(T0,)> + impl>> + ::planus::WriteAsOffset + for SetSubchannelsRequestBuilder<(T0,)> { #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset { let (v0,) = &self.0; - Binary::create(builder, v0) + SetSubchannelsRequest::create(builder, v0) } } - /// Reference to a deserialized [Binary]. + /// Reference to a deserialized [SetSubchannelsRequest]. #[derive(Copy, Clone)] - pub struct BinaryRef<'a>(::planus::table_reader::Table<'a>); + pub struct SetSubchannelsRequestRef<'a>(::planus::table_reader::Table<'a>); - impl<'a> BinaryRef<'a> { - /// Getter for the [`value` field](Binary#structfield.value). + impl<'a> SetSubchannelsRequestRef<'a> { + /// Getter for the [`subchannels` field](SetSubchannelsRequest#structfield.subchannels). #[inline] - pub fn value(&self) -> ::planus::Result<&'a [u8]> { - self.0.access_required(0, "Binary", "value") + pub fn subchannels(&self) -> ::planus::Result<::planus::Vector<'a, u16>> { + self.0 + .access_required(0, "SetSubchannelsRequest", "subchannels") } } - impl<'a> ::core::fmt::Debug for BinaryRef<'a> { + impl<'a> ::core::fmt::Debug for SetSubchannelsRequestRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("BinaryRef"); - f.field("value", &self.value()); + let mut f = f.debug_struct("SetSubchannelsRequestRef"); + f.field("subchannels", &self.subchannels()); f.finish() } } - impl<'a> ::core::convert::TryFrom> for Binary { + impl<'a> ::core::convert::TryFrom> for SetSubchannelsRequest { type Error = ::planus::Error; #[allow(unreachable_code)] - fn try_from(value: BinaryRef<'a>) -> ::planus::Result { + fn try_from(value: SetSubchannelsRequestRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - value: value.value()?.to_vec(), + subchannels: value.subchannels()?.to_vec()?, }) } } - impl<'a> ::planus::TableRead<'a> for BinaryRef<'a> { + impl<'a> ::planus::TableRead<'a> for SetSubchannelsRequestRef<'a> { #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, @@ -25757,7 +25841,7 @@ mod root { } } - impl<'a> ::planus::VectorReadInner<'a> for BinaryRef<'a> { + impl<'a> ::planus::VectorReadInner<'a> for SetSubchannelsRequestRef<'a> { type Error = ::planus::Error; const STRIDE: usize = 4; @@ -25767,7 +25851,7 @@ mod root { ) -> ::planus::Result { ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { error_kind.with_error_location( - "[BinaryRef]", + "[SetSubchannelsRequestRef]", "get", buffer.offset_from_start, ) @@ -25775,8 +25859,8 @@ mod root { } } - impl ::planus::VectorWrite<::planus::Offset> for Binary { - type Value = ::planus::Offset; + impl ::planus::VectorWrite<::planus::Offset> for SetSubchannelsRequest { + type Value = ::planus::Offset; const STRIDE: usize = 4; #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { @@ -25785,7 +25869,7 @@ mod root { #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[::planus::Offset], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { @@ -25800,7 +25884,7 @@ mod root { } } - impl<'a> ::planus::ReadAsRoot<'a> for BinaryRef<'a> { + impl<'a> ::planus::ReadAsRoot<'a> for SetSubchannelsRequestRef<'a> { fn read_as_root(slice: &'a [u8]) -> ::planus::Result { ::planus::TableRead::from_buffer( ::planus::SliceWithStartOffset { @@ -25810,15 +25894,19 @@ mod root { 0, ) .map_err(|error_kind| { - error_kind.with_error_location("[BinaryRef]", "read_as_root", 0) + error_kind.with_error_location( + "[SetSubchannelsRequestRef]", + "read_as_root", + 0, + ) }) } } - /// The union `Data` in the namespace `FBS.DataConsumer` + /// The table `SetSubchannelsResponse` in the namespace `FBS.DataConsumer` /// /// Generated from these locations: - /// * Union `Data` in the file `../worker/fbs/dataConsumer.fbs:45` + /// * Table `SetSubchannelsResponse` in the file `../worker/fbs/dataConsumer.fbs:46` #[derive( Clone, Debug, @@ -25830,421 +25918,489 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub enum Data { - /// The variant of type `String` in the union `Data` - String(::planus::alloc::boxed::Box), - - /// The variant of type `Binary` in the union `Data` - Binary(::planus::alloc::boxed::Box), + pub struct SetSubchannelsResponse { + /// The field `subchannels` in the table `SetSubchannelsResponse` + pub subchannels: ::planus::alloc::vec::Vec, } - impl Data { - /// Creates a [DataBuilder] for serializing an instance of this table. + impl SetSubchannelsResponse { + /// Creates a [SetSubchannelsResponseBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> DataBuilder<::planus::Uninitialized> { - DataBuilder(::planus::Uninitialized) + pub fn builder() -> SetSubchannelsResponseBuilder<()> { + SetSubchannelsResponseBuilder(()) } - #[inline] - pub fn create_string( + #[allow(clippy::too_many_arguments)] + pub fn create( builder: &mut ::planus::Builder, - value: impl ::planus::WriteAsOffset, - ) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(1, value.prepare(builder).downcast()) + field_subchannels: impl ::planus::WriteAs<::planus::Offset<[u16]>>, + ) -> ::planus::Offset { + let prepared_subchannels = field_subchannels.prepare(builder); + + let mut table_writer: ::planus::table_writer::TableWriter<6> = + ::core::default::Default::default(); + table_writer.write_entry::<::planus::Offset<[u16]>>(0); + + unsafe { + table_writer.finish(builder, |object_writer| { + object_writer.write::<_, _, 4>(&prepared_subchannels); + }); + } + builder.current_offset() } + } + + impl ::planus::WriteAs<::planus::Offset> for SetSubchannelsResponse { + type Prepared = ::planus::Offset; #[inline] - pub fn create_binary( + fn prepare( + &self, builder: &mut ::planus::Builder, - value: impl ::planus::WriteAsOffset, - ) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(2, value.prepare(builder).downcast()) + ) -> ::planus::Offset { + ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsUnion for Data { + impl ::planus::WriteAsOptional<::planus::Offset> + for SetSubchannelsResponse + { + type Prepared = ::planus::Offset; + #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - match self { - Self::String(value) => Self::create_string(builder, value), - Self::Binary(value) => Self::create_binary(builder, value), - } + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::core::option::Option<::planus::Offset> + { + ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOptionalUnion for Data { + impl ::planus::WriteAsOffset for SetSubchannelsResponse { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + SetSubchannelsResponse::create(builder, &self.subchannels) } } - /// Builder for serializing an instance of the [Data] type. + /// Builder for serializing an instance of the [SetSubchannelsResponse] type. /// - /// Can be created using the [Data::builder] method. + /// Can be created using the [SetSubchannelsResponse::builder] method. #[derive(Debug)] #[must_use] - pub struct DataBuilder(T); - - impl DataBuilder<::planus::Uninitialized> { - /// Creates an instance of the [`String` variant](Data#variant.String). - #[inline] - pub fn string(self, value: T) -> DataBuilder<::planus::Initialized<1, T>> - where - T: ::planus::WriteAsOffset, - { - DataBuilder(::planus::Initialized(value)) - } + pub struct SetSubchannelsResponseBuilder(State); - /// Creates an instance of the [`Binary` variant](Data#variant.Binary). + impl SetSubchannelsResponseBuilder<()> { + /// Setter for the [`subchannels` field](SetSubchannelsResponse#structfield.subchannels). #[inline] - pub fn binary(self, value: T) -> DataBuilder<::planus::Initialized<2, T>> + #[allow(clippy::type_complexity)] + pub fn subchannels(self, value: T0) -> SetSubchannelsResponseBuilder<(T0,)> where - T: ::planus::WriteAsOffset, + T0: ::planus::WriteAs<::planus::Offset<[u16]>>, { - DataBuilder(::planus::Initialized(value)) + SetSubchannelsResponseBuilder((value,)) } } - impl DataBuilder<::planus::Initialized> { - /// Finish writing the builder to get an [UnionOffset](::planus::UnionOffset) to a serialized [Data]. + impl SetSubchannelsResponseBuilder<(T0,)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SetSubchannelsResponse]. #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset + pub fn finish( + self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset where - Self: ::planus::WriteAsUnion, + Self: ::planus::WriteAsOffset, { - ::planus::WriteAsUnion::prepare(&self, builder) + ::planus::WriteAsOffset::prepare(&self, builder) } } - impl ::planus::WriteAsUnion for DataBuilder<::planus::Initialized<1, T>> - where - T: ::planus::WriteAsOffset, + impl>> + ::planus::WriteAs<::planus::Offset> + for SetSubchannelsResponseBuilder<(T0,)> { - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(1, (self.0).0.prepare(builder).downcast()) - } - } + type Prepared = ::planus::Offset; - impl ::planus::WriteAsOptionalUnion for DataBuilder<::planus::Initialized<1, T>> - where - T: ::planus::WriteAsOffset, - { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsUnion for DataBuilder<::planus::Initialized<2, T>> - where - T: ::planus::WriteAsOffset, + + impl>> + ::planus::WriteAsOptional<::planus::Offset> + for SetSubchannelsResponseBuilder<(T0,)> { + type Prepared = ::planus::Offset; + #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(2, (self.0).0.prepare(builder).downcast()) + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::core::option::Option<::planus::Offset> + { + ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOptionalUnion for DataBuilder<::planus::Initialized<2, T>> - where - T: ::planus::WriteAsOffset, + impl>> + ::planus::WriteAsOffset + for SetSubchannelsResponseBuilder<(T0,)> { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + let (v0,) = &self.0; + SetSubchannelsResponse::create(builder, v0) } } - /// Reference to a deserialized [Data]. - #[derive(Copy, Clone, Debug)] - pub enum DataRef<'a> { - String(self::StringRef<'a>), - Binary(self::BinaryRef<'a>), + /// Reference to a deserialized [SetSubchannelsResponse]. + #[derive(Copy, Clone)] + pub struct SetSubchannelsResponseRef<'a>(::planus::table_reader::Table<'a>); + + impl<'a> SetSubchannelsResponseRef<'a> { + /// Getter for the [`subchannels` field](SetSubchannelsResponse#structfield.subchannels). + #[inline] + pub fn subchannels(&self) -> ::planus::Result<::planus::Vector<'a, u16>> { + self.0 + .access_required(0, "SetSubchannelsResponse", "subchannels") + } } - impl<'a> ::core::convert::TryFrom> for Data { - type Error = ::planus::Error; + impl<'a> ::core::fmt::Debug for SetSubchannelsResponseRef<'a> { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut f = f.debug_struct("SetSubchannelsResponseRef"); + f.field("subchannels", &self.subchannels()); + f.finish() + } + } - fn try_from(value: DataRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(match value { - DataRef::String(value) => Self::String(::planus::alloc::boxed::Box::new( - ::core::convert::TryFrom::try_from(value)?, - )), + impl<'a> ::core::convert::TryFrom> for SetSubchannelsResponse { + type Error = ::planus::Error; - DataRef::Binary(value) => Self::Binary(::planus::alloc::boxed::Box::new( - ::core::convert::TryFrom::try_from(value)?, - )), + #[allow(unreachable_code)] + fn try_from(value: SetSubchannelsResponseRef<'a>) -> ::planus::Result { + ::core::result::Result::Ok(Self { + subchannels: value.subchannels()?.to_vec()?, }) } } - impl<'a> ::planus::TableReadUnion<'a> for DataRef<'a> { + impl<'a> ::planus::TableRead<'a> for SetSubchannelsResponseRef<'a> { + #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, - field_offset: usize, - tag: u8, + offset: usize, ) -> ::core::result::Result { - match tag { - 1 => ::core::result::Result::Ok(Self::String( - ::planus::TableRead::from_buffer(buffer, field_offset)?, - )), - 2 => ::core::result::Result::Ok(Self::Binary( - ::planus::TableRead::from_buffer(buffer, field_offset)?, - )), - _ => ::core::result::Result::Err( - ::planus::errors::ErrorKind::UnknownUnionTag { tag }, - ), - } + ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( + buffer, offset, + )?)) } } - /// The table `SendRequest` in the namespace `FBS.DataConsumer` - /// - /// Generated from these locations: - /// * Table `SendRequest` in the file `../worker/fbs/dataConsumer.fbs:50` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct SendRequest { - /// The field `ppid` in the table `SendRequest` - pub ppid: u32, - /// The field `data` in the table `SendRequest` - pub data: self::Data, + impl<'a> ::planus::VectorReadInner<'a> for SetSubchannelsResponseRef<'a> { + type Error = ::planus::Error; + const STRIDE: usize = 4; + + unsafe fn from_buffer( + buffer: ::planus::SliceWithStartOffset<'a>, + offset: usize, + ) -> ::planus::Result { + ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { + error_kind.with_error_location( + "[SetSubchannelsResponseRef]", + "get", + buffer.offset_from_start, + ) + }) + } } - impl SendRequest { - /// Creates a [SendRequestBuilder] for serializing an instance of this table. + impl ::planus::VectorWrite<::planus::Offset> for SetSubchannelsResponse { + type Value = ::planus::Offset; + const STRIDE: usize = 4; #[inline] - pub fn builder() -> SendRequestBuilder<()> { - SendRequestBuilder(()) + fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { + ::planus::WriteAs::prepare(self, builder) } - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_ppid: impl ::planus::WriteAsDefault, - field_data: impl ::planus::WriteAsUnion, - ) -> ::planus::Offset { - let prepared_ppid = field_ppid.prepare(builder, &0); - let prepared_data = field_data.prepare(builder); - - let mut table_writer: ::planus::table_writer::TableWriter<10> = - ::core::default::Default::default(); - if prepared_ppid.is_some() { + #[inline] + unsafe fn write_values( + values: &[::planus::Offset], + bytes: *mut ::core::mem::MaybeUninit, + buffer_position: u32, + ) { + let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; + for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { + ::planus::WriteAsPrimitive::write( + v, + ::planus::Cursor::new(&mut *bytes.add(i)), + buffer_position - (Self::STRIDE * i) as u32, + ); + } + } + } + + impl<'a> ::planus::ReadAsRoot<'a> for SetSubchannelsResponseRef<'a> { + fn read_as_root(slice: &'a [u8]) -> ::planus::Result { + ::planus::TableRead::from_buffer( + ::planus::SliceWithStartOffset { + buffer: slice, + offset_from_start: 0, + }, + 0, + ) + .map_err(|error_kind| { + error_kind.with_error_location( + "[SetSubchannelsResponseRef]", + "read_as_root", + 0, + ) + }) + } + } + + /// The table `BufferedAmountLowNotification` in the namespace `FBS.DataConsumer` + /// + /// Generated from these locations: + /// * Table `BufferedAmountLowNotification` in the file `../worker/fbs/dataConsumer.fbs:52` + #[derive( + Clone, + Debug, + PartialEq, + PartialOrd, + Eq, + Ord, + Hash, + ::serde::Serialize, + ::serde::Deserialize, + )] + pub struct BufferedAmountLowNotification { + /// The field `buffered_amount` in the table `BufferedAmountLowNotification` + pub buffered_amount: u32, + } + + #[allow(clippy::derivable_impls)] + impl ::core::default::Default for BufferedAmountLowNotification { + fn default() -> Self { + Self { buffered_amount: 0 } + } + } + + impl BufferedAmountLowNotification { + /// Creates a [BufferedAmountLowNotificationBuilder] for serializing an instance of this table. + #[inline] + pub fn builder() -> BufferedAmountLowNotificationBuilder<()> { + BufferedAmountLowNotificationBuilder(()) + } + + #[allow(clippy::too_many_arguments)] + pub fn create( + builder: &mut ::planus::Builder, + field_buffered_amount: impl ::planus::WriteAsDefault, + ) -> ::planus::Offset { + let prepared_buffered_amount = field_buffered_amount.prepare(builder, &0); + + let mut table_writer: ::planus::table_writer::TableWriter<6> = + ::core::default::Default::default(); + if prepared_buffered_amount.is_some() { table_writer.write_entry::(0); } - table_writer.write_entry::<::planus::Offset>(2); - table_writer.write_entry::(1); unsafe { table_writer.finish(builder, |object_writer| { - if let ::core::option::Option::Some(prepared_ppid) = prepared_ppid { - object_writer.write::<_, _, 4>(&prepared_ppid); + if let ::core::option::Option::Some(prepared_buffered_amount) = + prepared_buffered_amount + { + object_writer.write::<_, _, 4>(&prepared_buffered_amount); } - object_writer.write::<_, _, 4>(&prepared_data.offset()); - object_writer.write::<_, _, 1>(&prepared_data.tag()); }); } builder.current_offset() } } - impl ::planus::WriteAs<::planus::Offset> for SendRequest { + impl ::planus::WriteAs<::planus::Offset> + for BufferedAmountLowNotification + { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsOptional<::planus::Offset> for SendRequest { + impl ::planus::WriteAsOptional<::planus::Offset> + for BufferedAmountLowNotification + { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> + { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOffset for SendRequest { + impl ::planus::WriteAsOffset for BufferedAmountLowNotification { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - SendRequest::create(builder, self.ppid, &self.data) + ) -> ::planus::Offset { + BufferedAmountLowNotification::create(builder, self.buffered_amount) } } - /// Builder for serializing an instance of the [SendRequest] type. + /// Builder for serializing an instance of the [BufferedAmountLowNotification] type. /// - /// Can be created using the [SendRequest::builder] method. + /// Can be created using the [BufferedAmountLowNotification::builder] method. #[derive(Debug)] #[must_use] - pub struct SendRequestBuilder(State); + pub struct BufferedAmountLowNotificationBuilder(State); - impl SendRequestBuilder<()> { - /// Setter for the [`ppid` field](SendRequest#structfield.ppid). + impl BufferedAmountLowNotificationBuilder<()> { + /// Setter for the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount). #[inline] #[allow(clippy::type_complexity)] - pub fn ppid(self, value: T0) -> SendRequestBuilder<(T0,)> + pub fn buffered_amount( + self, + value: T0, + ) -> BufferedAmountLowNotificationBuilder<(T0,)> where T0: ::planus::WriteAsDefault, { - SendRequestBuilder((value,)) - } - - /// Sets the [`ppid` field](SendRequest#structfield.ppid) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn ppid_as_default(self) -> SendRequestBuilder<(::planus::DefaultValue,)> { - self.ppid(::planus::DefaultValue) + BufferedAmountLowNotificationBuilder((value,)) } - } - impl SendRequestBuilder<(T0,)> { - /// Setter for the [`data` field](SendRequest#structfield.data). + /// Sets the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount) to the default value. #[inline] #[allow(clippy::type_complexity)] - pub fn data(self, value: T1) -> SendRequestBuilder<(T0, T1)> - where - T1: ::planus::WriteAsUnion, + pub fn buffered_amount_as_default( + self, + ) -> BufferedAmountLowNotificationBuilder<(::planus::DefaultValue,)> { - let (v0,) = self.0; - SendRequestBuilder((v0, value)) + self.buffered_amount(::planus::DefaultValue) } } - impl SendRequestBuilder<(T0, T1)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SendRequest]. + impl BufferedAmountLowNotificationBuilder<(T0,)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [BufferedAmountLowNotification]. #[inline] pub fn finish( self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset + ) -> ::planus::Offset where - Self: ::planus::WriteAsOffset, + Self: ::planus::WriteAsOffset, { ::planus::WriteAsOffset::prepare(&self, builder) } } - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, - > ::planus::WriteAs<::planus::Offset> - for SendRequestBuilder<(T0, T1)> + impl> + ::planus::WriteAs<::planus::Offset> + for BufferedAmountLowNotificationBuilder<(T0,)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, - > ::planus::WriteAsOptional<::planus::Offset> - for SendRequestBuilder<(T0, T1)> + impl> + ::planus::WriteAsOptional<::planus::Offset> + for BufferedAmountLowNotificationBuilder<(T0,)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { + ) -> ::core::option::Option<::planus::Offset> + { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, - > ::planus::WriteAsOffset for SendRequestBuilder<(T0, T1)> + impl> + ::planus::WriteAsOffset + for BufferedAmountLowNotificationBuilder<(T0,)> { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0, v1) = &self.0; - SendRequest::create(builder, v0, v1) + ) -> ::planus::Offset { + let (v0,) = &self.0; + BufferedAmountLowNotification::create(builder, v0) } } - /// Reference to a deserialized [SendRequest]. + /// Reference to a deserialized [BufferedAmountLowNotification]. #[derive(Copy, Clone)] - pub struct SendRequestRef<'a>(::planus::table_reader::Table<'a>); + pub struct BufferedAmountLowNotificationRef<'a>(::planus::table_reader::Table<'a>); - impl<'a> SendRequestRef<'a> { - /// Getter for the [`ppid` field](SendRequest#structfield.ppid). + impl<'a> BufferedAmountLowNotificationRef<'a> { + /// Getter for the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount). #[inline] - pub fn ppid(&self) -> ::planus::Result { + pub fn buffered_amount(&self) -> ::planus::Result { ::core::result::Result::Ok( - self.0.access(0, "SendRequest", "ppid")?.unwrap_or(0), + self.0 + .access(0, "BufferedAmountLowNotification", "buffered_amount")? + .unwrap_or(0), ) } - - /// Getter for the [`data` field](SendRequest#structfield.data). - #[inline] - pub fn data(&self) -> ::planus::Result> { - self.0.access_union_required(1, "SendRequest", "data") - } } - impl<'a> ::core::fmt::Debug for SendRequestRef<'a> { + impl<'a> ::core::fmt::Debug for BufferedAmountLowNotificationRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("SendRequestRef"); - f.field("ppid", &self.ppid()); - f.field("data", &self.data()); + let mut f = f.debug_struct("BufferedAmountLowNotificationRef"); + f.field("buffered_amount", &self.buffered_amount()); f.finish() } } - impl<'a> ::core::convert::TryFrom> for SendRequest { + impl<'a> ::core::convert::TryFrom> + for BufferedAmountLowNotification + { type Error = ::planus::Error; #[allow(unreachable_code)] - fn try_from(value: SendRequestRef<'a>) -> ::planus::Result { + fn try_from(value: BufferedAmountLowNotificationRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - ppid: ::core::convert::TryInto::try_into(value.ppid()?)?, - data: ::core::convert::TryInto::try_into(value.data()?)?, + buffered_amount: ::core::convert::TryInto::try_into( + value.buffered_amount()?, + )?, }) } } - impl<'a> ::planus::TableRead<'a> for SendRequestRef<'a> { + impl<'a> ::planus::TableRead<'a> for BufferedAmountLowNotificationRef<'a> { #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, @@ -26256,7 +26412,7 @@ mod root { } } - impl<'a> ::planus::VectorReadInner<'a> for SendRequestRef<'a> { + impl<'a> ::planus::VectorReadInner<'a> for BufferedAmountLowNotificationRef<'a> { type Error = ::planus::Error; const STRIDE: usize = 4; @@ -26266,7 +26422,7 @@ mod root { ) -> ::planus::Result { ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { error_kind.with_error_location( - "[SendRequestRef]", + "[BufferedAmountLowNotificationRef]", "get", buffer.offset_from_start, ) @@ -26274,8 +26430,10 @@ mod root { } } - impl ::planus::VectorWrite<::planus::Offset> for SendRequest { - type Value = ::planus::Offset; + impl ::planus::VectorWrite<::planus::Offset> + for BufferedAmountLowNotification + { + type Value = ::planus::Offset; const STRIDE: usize = 4; #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { @@ -26284,7 +26442,7 @@ mod root { #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[::planus::Offset], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { @@ -26299,7 +26457,7 @@ mod root { } } - impl<'a> ::planus::ReadAsRoot<'a> for SendRequestRef<'a> { + impl<'a> ::planus::ReadAsRoot<'a> for BufferedAmountLowNotificationRef<'a> { fn read_as_root(slice: &'a [u8]) -> ::planus::Result { ::planus::TableRead::from_buffer( ::planus::SliceWithStartOffset { @@ -26309,15 +26467,19 @@ mod root { 0, ) .map_err(|error_kind| { - error_kind.with_error_location("[SendRequestRef]", "read_as_root", 0) + error_kind.with_error_location( + "[BufferedAmountLowNotificationRef]", + "read_as_root", + 0, + ) }) } } - /// The table `SetSubchannelsRequest` in the namespace `FBS.DataConsumer` + /// The table `MessageNotification` in the namespace `FBS.DataConsumer` /// /// Generated from these locations: - /// * Table `SetSubchannelsRequest` in the file `../worker/fbs/dataConsumer.fbs:55` + /// * Table `MessageNotification` in the file `../worker/fbs/dataConsumer.fbs:56` #[derive( Clone, Debug, @@ -26329,184 +26491,231 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub struct SetSubchannelsRequest { - /// The field `subchannels` in the table `SetSubchannelsRequest` - pub subchannels: ::planus::alloc::vec::Vec, + pub struct MessageNotification { + /// The field `ppid` in the table `MessageNotification` + pub ppid: u32, + /// The field `data` in the table `MessageNotification` + pub data: ::planus::alloc::vec::Vec, } - impl SetSubchannelsRequest { - /// Creates a [SetSubchannelsRequestBuilder] for serializing an instance of this table. + impl MessageNotification { + /// Creates a [MessageNotificationBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> SetSubchannelsRequestBuilder<()> { - SetSubchannelsRequestBuilder(()) + pub fn builder() -> MessageNotificationBuilder<()> { + MessageNotificationBuilder(()) } #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - field_subchannels: impl ::planus::WriteAs<::planus::Offset<[u16]>>, + field_ppid: impl ::planus::WriteAsDefault, + field_data: impl ::planus::WriteAs<::planus::Offset<[u8]>>, ) -> ::planus::Offset { - let prepared_subchannels = field_subchannels.prepare(builder); + let prepared_ppid = field_ppid.prepare(builder, &0); + let prepared_data = field_data.prepare(builder); - let mut table_writer: ::planus::table_writer::TableWriter<6> = + let mut table_writer: ::planus::table_writer::TableWriter<8> = ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset<[u16]>>(0); + if prepared_ppid.is_some() { + table_writer.write_entry::(0); + } + table_writer.write_entry::<::planus::Offset<[u8]>>(1); unsafe { table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_subchannels); + if let ::core::option::Option::Some(prepared_ppid) = prepared_ppid { + object_writer.write::<_, _, 4>(&prepared_ppid); + } + object_writer.write::<_, _, 4>(&prepared_data); }); } builder.current_offset() } } - impl ::planus::WriteAs<::planus::Offset> for SetSubchannelsRequest { + impl ::planus::WriteAs<::planus::Offset> for MessageNotification { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsOptional<::planus::Offset> for SetSubchannelsRequest { + impl ::planus::WriteAsOptional<::planus::Offset> for MessageNotification { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOffset for SetSubchannelsRequest { + impl ::planus::WriteAsOffset for MessageNotification { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - SetSubchannelsRequest::create(builder, &self.subchannels) + ) -> ::planus::Offset { + MessageNotification::create(builder, self.ppid, &self.data) } } - /// Builder for serializing an instance of the [SetSubchannelsRequest] type. + /// Builder for serializing an instance of the [MessageNotification] type. /// - /// Can be created using the [SetSubchannelsRequest::builder] method. + /// Can be created using the [MessageNotification::builder] method. #[derive(Debug)] #[must_use] - pub struct SetSubchannelsRequestBuilder(State); + pub struct MessageNotificationBuilder(State); - impl SetSubchannelsRequestBuilder<()> { - /// Setter for the [`subchannels` field](SetSubchannelsRequest#structfield.subchannels). + impl MessageNotificationBuilder<()> { + /// Setter for the [`ppid` field](MessageNotification#structfield.ppid). #[inline] #[allow(clippy::type_complexity)] - pub fn subchannels(self, value: T0) -> SetSubchannelsRequestBuilder<(T0,)> + pub fn ppid(self, value: T0) -> MessageNotificationBuilder<(T0,)> where - T0: ::planus::WriteAs<::planus::Offset<[u16]>>, + T0: ::planus::WriteAsDefault, { - SetSubchannelsRequestBuilder((value,)) + MessageNotificationBuilder((value,)) + } + + /// Sets the [`ppid` field](MessageNotification#structfield.ppid) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn ppid_as_default( + self, + ) -> MessageNotificationBuilder<(::planus::DefaultValue,)> { + self.ppid(::planus::DefaultValue) } } - impl SetSubchannelsRequestBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SetSubchannelsRequest]. + impl MessageNotificationBuilder<(T0,)> { + /// Setter for the [`data` field](MessageNotification#structfield.data). + #[inline] + #[allow(clippy::type_complexity)] + pub fn data(self, value: T1) -> MessageNotificationBuilder<(T0, T1)> + where + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + { + let (v0,) = self.0; + MessageNotificationBuilder((v0, value)) + } + } + + impl MessageNotificationBuilder<(T0, T1)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [MessageNotification]. #[inline] pub fn finish( self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset + ) -> ::planus::Offset where - Self: ::planus::WriteAsOffset, + Self: ::planus::WriteAsOffset, { ::planus::WriteAsOffset::prepare(&self, builder) } } - impl>> - ::planus::WriteAs<::planus::Offset> - for SetSubchannelsRequestBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAs<::planus::Offset> + for MessageNotificationBuilder<(T0, T1)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl>> - ::planus::WriteAsOptional<::planus::Offset> - for SetSubchannelsRequestBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAsOptional<::planus::Offset> + for MessageNotificationBuilder<(T0, T1)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl>> - ::planus::WriteAsOffset - for SetSubchannelsRequestBuilder<(T0,)> + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, + > ::planus::WriteAsOffset + for MessageNotificationBuilder<(T0, T1)> { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0,) = &self.0; - SetSubchannelsRequest::create(builder, v0) + ) -> ::planus::Offset { + let (v0, v1) = &self.0; + MessageNotification::create(builder, v0, v1) } } - /// Reference to a deserialized [SetSubchannelsRequest]. + /// Reference to a deserialized [MessageNotification]. #[derive(Copy, Clone)] - pub struct SetSubchannelsRequestRef<'a>(::planus::table_reader::Table<'a>); + pub struct MessageNotificationRef<'a>(::planus::table_reader::Table<'a>); - impl<'a> SetSubchannelsRequestRef<'a> { - /// Getter for the [`subchannels` field](SetSubchannelsRequest#structfield.subchannels). + impl<'a> MessageNotificationRef<'a> { + /// Getter for the [`ppid` field](MessageNotification#structfield.ppid). #[inline] - pub fn subchannels(&self) -> ::planus::Result<::planus::Vector<'a, u16>> { - self.0 - .access_required(0, "SetSubchannelsRequest", "subchannels") + pub fn ppid(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0 + .access(0, "MessageNotification", "ppid")? + .unwrap_or(0), + ) + } + + /// Getter for the [`data` field](MessageNotification#structfield.data). + #[inline] + pub fn data(&self) -> ::planus::Result<&'a [u8]> { + self.0.access_required(1, "MessageNotification", "data") } } - impl<'a> ::core::fmt::Debug for SetSubchannelsRequestRef<'a> { + impl<'a> ::core::fmt::Debug for MessageNotificationRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("SetSubchannelsRequestRef"); - f.field("subchannels", &self.subchannels()); + let mut f = f.debug_struct("MessageNotificationRef"); + f.field("ppid", &self.ppid()); + f.field("data", &self.data()); f.finish() } } - impl<'a> ::core::convert::TryFrom> for SetSubchannelsRequest { + impl<'a> ::core::convert::TryFrom> for MessageNotification { type Error = ::planus::Error; #[allow(unreachable_code)] - fn try_from(value: SetSubchannelsRequestRef<'a>) -> ::planus::Result { + fn try_from(value: MessageNotificationRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - subchannels: value.subchannels()?.to_vec()?, + ppid: ::core::convert::TryInto::try_into(value.ppid()?)?, + data: value.data()?.to_vec(), }) } } - impl<'a> ::planus::TableRead<'a> for SetSubchannelsRequestRef<'a> { + impl<'a> ::planus::TableRead<'a> for MessageNotificationRef<'a> { #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, @@ -26518,7 +26727,7 @@ mod root { } } - impl<'a> ::planus::VectorReadInner<'a> for SetSubchannelsRequestRef<'a> { + impl<'a> ::planus::VectorReadInner<'a> for MessageNotificationRef<'a> { type Error = ::planus::Error; const STRIDE: usize = 4; @@ -26528,7 +26737,7 @@ mod root { ) -> ::planus::Result { ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { error_kind.with_error_location( - "[SetSubchannelsRequestRef]", + "[MessageNotificationRef]", "get", buffer.offset_from_start, ) @@ -26536,8 +26745,8 @@ mod root { } } - impl ::planus::VectorWrite<::planus::Offset> for SetSubchannelsRequest { - type Value = ::planus::Offset; + impl ::planus::VectorWrite<::planus::Offset> for MessageNotification { + type Value = ::planus::Offset; const STRIDE: usize = 4; #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { @@ -26546,7 +26755,7 @@ mod root { #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[::planus::Offset], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { @@ -26561,7 +26770,7 @@ mod root { } } - impl<'a> ::planus::ReadAsRoot<'a> for SetSubchannelsRequestRef<'a> { + impl<'a> ::planus::ReadAsRoot<'a> for MessageNotificationRef<'a> { fn read_as_root(slice: &'a [u8]) -> ::planus::Result { ::planus::TableRead::from_buffer( ::planus::SliceWithStartOffset { @@ -26572,286 +26781,193 @@ mod root { ) .map_err(|error_kind| { error_kind.with_error_location( - "[SetSubchannelsRequestRef]", + "[MessageNotificationRef]", "read_as_root", 0, ) }) } } - - /// The table `SetSubchannelsResponse` in the namespace `FBS.DataConsumer` + } + /// The namespace `FBS.DataProducer` + /// + /// Generated from these locations: + /// * File `../worker/fbs/dataProducer.fbs` + pub mod data_producer { + /// The enum `Type` in the namespace `FBS.DataProducer` /// /// Generated from these locations: - /// * Table `SetSubchannelsResponse` in the file `../worker/fbs/dataConsumer.fbs:59` + /// * Enum `Type` in the file `../worker/fbs/dataProducer.fbs:5` #[derive( + Copy, Clone, Debug, PartialEq, - PartialOrd, Eq, + PartialOrd, Ord, Hash, ::serde::Serialize, ::serde::Deserialize, )] - pub struct SetSubchannelsResponse { - /// The field `subchannels` in the table `SetSubchannelsResponse` - pub subchannels: ::planus::alloc::vec::Vec, - } + #[repr(u8)] + pub enum Type { + /// The variant `SCTP` in the enum `Type` + Sctp = 0, - impl SetSubchannelsResponse { - /// Creates a [SetSubchannelsResponseBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> SetSubchannelsResponseBuilder<()> { - SetSubchannelsResponseBuilder(()) - } + /// The variant `DIRECT` in the enum `Type` + Direct = 1, + } - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_subchannels: impl ::planus::WriteAs<::planus::Offset<[u16]>>, - ) -> ::planus::Offset { - let prepared_subchannels = field_subchannels.prepare(builder); + impl Type { + /// Array containing all valid variants of Type + pub const ENUM_VALUES: [Self; 2] = [Self::Sctp, Self::Direct]; + } - let mut table_writer: ::planus::table_writer::TableWriter<6> = - ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset<[u16]>>(0); + impl ::core::convert::TryFrom for Type { + type Error = ::planus::errors::UnknownEnumTagKind; + #[inline] + fn try_from( + value: u8, + ) -> ::core::result::Result + { + #[allow(clippy::match_single_binding)] + match value { + 0 => ::core::result::Result::Ok(Type::Sctp), + 1 => ::core::result::Result::Ok(Type::Direct), - unsafe { - table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_subchannels); - }); + _ => ::core::result::Result::Err(::planus::errors::UnknownEnumTagKind { + tag: value as i128, + }), } - builder.current_offset() } } - impl ::planus::WriteAs<::planus::Offset> for SetSubchannelsResponse { - type Prepared = ::planus::Offset; - + impl ::core::convert::From for u8 { #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) + fn from(value: Type) -> Self { + value as u8 } } - impl ::planus::WriteAsOptional<::planus::Offset> - for SetSubchannelsResponse - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } + impl ::planus::Primitive for Type { + const ALIGNMENT: usize = 1; + const SIZE: usize = 1; } - impl ::planus::WriteAsOffset for SetSubchannelsResponse { + impl ::planus::WriteAsPrimitive for Type { #[inline] - fn prepare( + fn write( &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - SetSubchannelsResponse::create(builder, &self.subchannels) + cursor: ::planus::Cursor<'_, N>, + buffer_position: u32, + ) { + (*self as u8).write(cursor, buffer_position); } } - /// Builder for serializing an instance of the [SetSubchannelsResponse] type. - /// - /// Can be created using the [SetSubchannelsResponse::builder] method. - #[derive(Debug)] - #[must_use] - pub struct SetSubchannelsResponseBuilder(State); - - impl SetSubchannelsResponseBuilder<()> { - /// Setter for the [`subchannels` field](SetSubchannelsResponse#structfield.subchannels). - #[inline] - #[allow(clippy::type_complexity)] - pub fn subchannels(self, value: T0) -> SetSubchannelsResponseBuilder<(T0,)> - where - T0: ::planus::WriteAs<::planus::Offset<[u16]>>, - { - SetSubchannelsResponseBuilder((value,)) - } - } + impl ::planus::WriteAs for Type { + type Prepared = Self; - impl SetSubchannelsResponseBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [SetSubchannelsResponse]. #[inline] - pub fn finish( - self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) + fn prepare(&self, _builder: &mut ::planus::Builder) -> Type { + *self } } - impl>> - ::planus::WriteAs<::planus::Offset> - for SetSubchannelsResponseBuilder<(T0,)> - { - type Prepared = ::planus::Offset; + impl ::planus::WriteAsDefault for Type { + type Prepared = Self; #[inline] fn prepare( &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) + _builder: &mut ::planus::Builder, + default: &Type, + ) -> ::core::option::Option { + if self == default { + ::core::option::Option::None + } else { + ::core::option::Option::Some(*self) + } } } - impl>> - ::planus::WriteAsOptional<::planus::Offset> - for SetSubchannelsResponseBuilder<(T0,)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } + impl ::planus::WriteAsOptional for Type { + type Prepared = Self; - impl>> - ::planus::WriteAsOffset - for SetSubchannelsResponseBuilder<(T0,)> - { #[inline] fn prepare( &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0,) = &self.0; - SetSubchannelsResponse::create(builder, v0) - } - } - - /// Reference to a deserialized [SetSubchannelsResponse]. - #[derive(Copy, Clone)] - pub struct SetSubchannelsResponseRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> SetSubchannelsResponseRef<'a> { - /// Getter for the [`subchannels` field](SetSubchannelsResponse#structfield.subchannels). - #[inline] - pub fn subchannels(&self) -> ::planus::Result<::planus::Vector<'a, u16>> { - self.0 - .access_required(0, "SetSubchannelsResponse", "subchannels") - } - } - - impl<'a> ::core::fmt::Debug for SetSubchannelsResponseRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("SetSubchannelsResponseRef"); - f.field("subchannels", &self.subchannels()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> for SetSubchannelsResponse { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: SetSubchannelsResponseRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - subchannels: value.subchannels()?.to_vec()?, - }) + _builder: &mut ::planus::Builder, + ) -> ::core::option::Option { + ::core::option::Option::Some(*self) } } - impl<'a> ::planus::TableRead<'a> for SetSubchannelsResponseRef<'a> { + impl<'buf> ::planus::TableRead<'buf> for Type { #[inline] fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, + buffer: ::planus::SliceWithStartOffset<'buf>, offset: usize, ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) + let n: u8 = ::planus::TableRead::from_buffer(buffer, offset)?; + ::core::result::Result::Ok(::core::convert::TryInto::try_into(n)?) } } - impl<'a> ::planus::VectorReadInner<'a> for SetSubchannelsResponseRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - + impl<'buf> ::planus::VectorReadInner<'buf> for Type { + type Error = ::planus::errors::UnknownEnumTag; + const STRIDE: usize = 1; + #[inline] unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, + buffer: ::planus::SliceWithStartOffset<'buf>, offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { + ) -> ::core::result::Result + { + let value = *buffer.buffer.get_unchecked(offset); + let value: ::core::result::Result = + ::core::convert::TryInto::try_into(value); + value.map_err(|error_kind| { error_kind.with_error_location( - "[SetSubchannelsResponseRef]", - "get", + "Type", + "VectorRead::from_buffer", buffer.offset_from_start, ) }) } } - impl ::planus::VectorWrite<::planus::Offset> for SetSubchannelsResponse { - type Value = ::planus::Offset; - const STRIDE: usize = 4; + impl ::planus::VectorWrite for Type { + const STRIDE: usize = 1; + + type Value = Self; + #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) + fn prepare(&self, _builder: &mut ::planus::Builder) -> Self { + *self } #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[Self], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; + let bytes = bytes as *mut [::core::mem::MaybeUninit; 1]; for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { ::planus::WriteAsPrimitive::write( v, ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, + buffer_position - i as u32, ); } } } - impl<'a> ::planus::ReadAsRoot<'a> for SetSubchannelsResponseRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location( - "[SetSubchannelsResponseRef]", - "read_as_root", - 0, - ) - }) - } - } - - /// The table `BufferedAmountLowNotification` in the namespace `FBS.DataConsumer` + /// The table `DumpResponse` in the namespace `FBS.DataProducer` /// /// Generated from these locations: - /// * Table `BufferedAmountLowNotification` in the file `../worker/fbs/dataConsumer.fbs:65` + /// * Table `DumpResponse` in the file `../worker/fbs/dataProducer.fbs:10` #[derive( Clone, Debug, @@ -26863,44 +26979,80 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub struct BufferedAmountLowNotification { - /// The field `buffered_amount` in the table `BufferedAmountLowNotification` - pub buffered_amount: u32, - } - - #[allow(clippy::derivable_impls)] - impl ::core::default::Default for BufferedAmountLowNotification { - fn default() -> Self { - Self { buffered_amount: 0 } - } + pub struct DumpResponse { + /// The field `id` in the table `DumpResponse` + pub id: ::planus::alloc::string::String, + /// The field `type` in the table `DumpResponse` + pub type_: self::Type, + /// The field `sctp_stream_parameters` in the table `DumpResponse` + pub sctp_stream_parameters: ::core::option::Option< + ::planus::alloc::boxed::Box, + >, + /// The field `label` in the table `DumpResponse` + pub label: ::planus::alloc::string::String, + /// The field `protocol` in the table `DumpResponse` + pub protocol: ::planus::alloc::string::String, + /// The field `paused` in the table `DumpResponse` + pub paused: bool, } - impl BufferedAmountLowNotification { - /// Creates a [BufferedAmountLowNotificationBuilder] for serializing an instance of this table. + impl DumpResponse { + /// Creates a [DumpResponseBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> BufferedAmountLowNotificationBuilder<()> { - BufferedAmountLowNotificationBuilder(()) + pub fn builder() -> DumpResponseBuilder<()> { + DumpResponseBuilder(()) } #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - field_buffered_amount: impl ::planus::WriteAsDefault, + field_id: impl ::planus::WriteAs<::planus::Offset>, + field_type_: impl ::planus::WriteAsDefault, + field_sctp_stream_parameters: impl ::planus::WriteAsOptional< + ::planus::Offset, + >, + field_label: impl ::planus::WriteAs<::planus::Offset>, + field_protocol: impl ::planus::WriteAs<::planus::Offset>, + field_paused: impl ::planus::WriteAsDefault, ) -> ::planus::Offset { - let prepared_buffered_amount = field_buffered_amount.prepare(builder, &0); + let prepared_id = field_id.prepare(builder); + let prepared_type_ = field_type_.prepare(builder, &self::Type::Sctp); + let prepared_sctp_stream_parameters = + field_sctp_stream_parameters.prepare(builder); + let prepared_label = field_label.prepare(builder); + let prepared_protocol = field_protocol.prepare(builder); + let prepared_paused = field_paused.prepare(builder, &false); - let mut table_writer: ::planus::table_writer::TableWriter<6> = + let mut table_writer: ::planus::table_writer::TableWriter<16> = ::core::default::Default::default(); - if prepared_buffered_amount.is_some() { - table_writer.write_entry::(0); + table_writer.write_entry::<::planus::Offset>(0); + if prepared_sctp_stream_parameters.is_some() { + table_writer.write_entry::<::planus::Offset>(2); + } + table_writer.write_entry::<::planus::Offset>(3); + table_writer.write_entry::<::planus::Offset>(4); + if prepared_type_.is_some() { + table_writer.write_entry::(1); + } + if prepared_paused.is_some() { + table_writer.write_entry::(5); } unsafe { table_writer.finish(builder, |object_writer| { - if let ::core::option::Option::Some(prepared_buffered_amount) = - prepared_buffered_amount + object_writer.write::<_, _, 4>(&prepared_id); + if let ::core::option::Option::Some(prepared_sctp_stream_parameters) = + prepared_sctp_stream_parameters { - object_writer.write::<_, _, 4>(&prepared_buffered_amount); + object_writer.write::<_, _, 4>(&prepared_sctp_stream_parameters); + } + object_writer.write::<_, _, 4>(&prepared_label); + object_writer.write::<_, _, 4>(&prepared_protocol); + if let ::core::option::Option::Some(prepared_type_) = prepared_type_ { + object_writer.write::<_, _, 1>(&prepared_type_); + } + if let ::core::option::Option::Some(prepared_paused) = prepared_paused { + object_writer.write::<_, _, 1>(&prepared_paused); } }); } @@ -26908,2162 +27060,338 @@ mod root { } } - impl ::planus::WriteAs<::planus::Offset> - for BufferedAmountLowNotification - { + impl ::planus::WriteAs<::planus::Offset> for DumpResponse { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsOptional<::planus::Offset> - for BufferedAmountLowNotification - { + impl ::planus::WriteAsOptional<::planus::Offset> for DumpResponse { type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOffset for BufferedAmountLowNotification { + impl ::planus::WriteAsOffset for DumpResponse { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - BufferedAmountLowNotification::create(builder, self.buffered_amount) + ) -> ::planus::Offset { + DumpResponse::create( + builder, + &self.id, + self.type_, + &self.sctp_stream_parameters, + &self.label, + &self.protocol, + self.paused, + ) } } - /// Builder for serializing an instance of the [BufferedAmountLowNotification] type. + /// Builder for serializing an instance of the [DumpResponse] type. /// - /// Can be created using the [BufferedAmountLowNotification::builder] method. + /// Can be created using the [DumpResponse::builder] method. #[derive(Debug)] #[must_use] - pub struct BufferedAmountLowNotificationBuilder(State); + pub struct DumpResponseBuilder(State); - impl BufferedAmountLowNotificationBuilder<()> { - /// Setter for the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount). + impl DumpResponseBuilder<()> { + /// Setter for the [`id` field](DumpResponse#structfield.id). #[inline] #[allow(clippy::type_complexity)] - pub fn buffered_amount( + pub fn id(self, value: T0) -> DumpResponseBuilder<(T0,)> + where + T0: ::planus::WriteAs<::planus::Offset>, + { + DumpResponseBuilder((value,)) + } + } + + impl DumpResponseBuilder<(T0,)> { + /// Setter for the [`type` field](DumpResponse#structfield.type_). + #[inline] + #[allow(clippy::type_complexity)] + pub fn type_(self, value: T1) -> DumpResponseBuilder<(T0, T1)> + where + T1: ::planus::WriteAsDefault, + { + let (v0,) = self.0; + DumpResponseBuilder((v0, value)) + } + + /// Sets the [`type` field](DumpResponse#structfield.type_) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn type_as_default(self) -> DumpResponseBuilder<(T0, ::planus::DefaultValue)> { + self.type_(::planus::DefaultValue) + } + } + + impl DumpResponseBuilder<(T0, T1)> { + /// Setter for the [`sctp_stream_parameters` field](DumpResponse#structfield.sctp_stream_parameters). + #[inline] + #[allow(clippy::type_complexity)] + pub fn sctp_stream_parameters( self, - value: T0, - ) -> BufferedAmountLowNotificationBuilder<(T0,)> + value: T2, + ) -> DumpResponseBuilder<(T0, T1, T2)> where - T0: ::planus::WriteAsDefault, + T2: ::planus::WriteAsOptional< + ::planus::Offset, + >, { - BufferedAmountLowNotificationBuilder((value,)) + let (v0, v1) = self.0; + DumpResponseBuilder((v0, v1, value)) } - /// Sets the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount) to the default value. + /// Sets the [`sctp_stream_parameters` field](DumpResponse#structfield.sctp_stream_parameters) to null. #[inline] #[allow(clippy::type_complexity)] - pub fn buffered_amount_as_default( + pub fn sctp_stream_parameters_as_null(self) -> DumpResponseBuilder<(T0, T1, ())> { + self.sctp_stream_parameters(()) + } + } + + impl DumpResponseBuilder<(T0, T1, T2)> { + /// Setter for the [`label` field](DumpResponse#structfield.label). + #[inline] + #[allow(clippy::type_complexity)] + pub fn label(self, value: T3) -> DumpResponseBuilder<(T0, T1, T2, T3)> + where + T3: ::planus::WriteAs<::planus::Offset>, + { + let (v0, v1, v2) = self.0; + DumpResponseBuilder((v0, v1, v2, value)) + } + } + + impl DumpResponseBuilder<(T0, T1, T2, T3)> { + /// Setter for the [`protocol` field](DumpResponse#structfield.protocol). + #[inline] + #[allow(clippy::type_complexity)] + pub fn protocol(self, value: T4) -> DumpResponseBuilder<(T0, T1, T2, T3, T4)> + where + T4: ::planus::WriteAs<::planus::Offset>, + { + let (v0, v1, v2, v3) = self.0; + DumpResponseBuilder((v0, v1, v2, v3, value)) + } + } + + impl DumpResponseBuilder<(T0, T1, T2, T3, T4)> { + /// Setter for the [`paused` field](DumpResponse#structfield.paused). + #[inline] + #[allow(clippy::type_complexity)] + pub fn paused(self, value: T5) -> DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> + where + T5: ::planus::WriteAsDefault, + { + let (v0, v1, v2, v3, v4) = self.0; + DumpResponseBuilder((v0, v1, v2, v3, v4, value)) + } + + /// Sets the [`paused` field](DumpResponse#structfield.paused) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn paused_as_default( self, - ) -> BufferedAmountLowNotificationBuilder<(::planus::DefaultValue,)> + ) -> DumpResponseBuilder<(T0, T1, T2, T3, T4, ::planus::DefaultValue)> { - self.buffered_amount(::planus::DefaultValue) + self.paused(::planus::DefaultValue) } } - impl BufferedAmountLowNotificationBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [BufferedAmountLowNotification]. + impl DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [DumpResponse]. #[inline] pub fn finish( self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset + ) -> ::planus::Offset where - Self: ::planus::WriteAsOffset, + Self: ::planus::WriteAsOffset, { ::planus::WriteAsOffset::prepare(&self, builder) } } - impl> - ::planus::WriteAs<::planus::Offset> - for BufferedAmountLowNotificationBuilder<(T0,)> + impl< + T0: ::planus::WriteAs<::planus::Offset>, + T1: ::planus::WriteAsDefault, + T2: ::planus::WriteAsOptional< + ::planus::Offset, + >, + T3: ::planus::WriteAs<::planus::Offset>, + T4: ::planus::WriteAs<::planus::Offset>, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAs<::planus::Offset> + for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { + ) -> ::planus::Offset { ::planus::WriteAsOffset::prepare(self, builder) } } - impl> - ::planus::WriteAsOptional<::planus::Offset> - for BufferedAmountLowNotificationBuilder<(T0,)> + impl< + T0: ::planus::WriteAs<::planus::Offset>, + T1: ::planus::WriteAsDefault, + T2: ::planus::WriteAsOptional< + ::planus::Offset, + >, + T3: ::planus::WriteAs<::planus::Offset>, + T4: ::planus::WriteAs<::planus::Offset>, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAsOptional<::planus::Offset> + for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> { - type Prepared = ::planus::Offset; + type Prepared = ::planus::Offset; #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> - { + ) -> ::core::option::Option<::planus::Offset> { ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl> - ::planus::WriteAsOffset - for BufferedAmountLowNotificationBuilder<(T0,)> + impl< + T0: ::planus::WriteAs<::planus::Offset>, + T1: ::planus::WriteAsDefault, + T2: ::planus::WriteAsOptional< + ::planus::Offset, + >, + T3: ::planus::WriteAs<::planus::Offset>, + T4: ::planus::WriteAs<::planus::Offset>, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAsOffset + for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0,) = &self.0; - BufferedAmountLowNotification::create(builder, v0) + ) -> ::planus::Offset { + let (v0, v1, v2, v3, v4, v5) = &self.0; + DumpResponse::create(builder, v0, v1, v2, v3, v4, v5) } } - /// Reference to a deserialized [BufferedAmountLowNotification]. + /// Reference to a deserialized [DumpResponse]. #[derive(Copy, Clone)] - pub struct BufferedAmountLowNotificationRef<'a>(::planus::table_reader::Table<'a>); + pub struct DumpResponseRef<'a>(::planus::table_reader::Table<'a>); - impl<'a> BufferedAmountLowNotificationRef<'a> { - /// Getter for the [`buffered_amount` field](BufferedAmountLowNotification#structfield.buffered_amount). + impl<'a> DumpResponseRef<'a> { + /// Getter for the [`id` field](DumpResponse#structfield.id). #[inline] - pub fn buffered_amount(&self) -> ::planus::Result { + pub fn id(&self) -> ::planus::Result<&'a ::core::primitive::str> { + self.0.access_required(0, "DumpResponse", "id") + } + + /// Getter for the [`type` field](DumpResponse#structfield.type_). + #[inline] + pub fn type_(&self) -> ::planus::Result { ::core::result::Result::Ok( self.0 - .access(0, "BufferedAmountLowNotification", "buffered_amount")? - .unwrap_or(0), - ) - } - } - - impl<'a> ::core::fmt::Debug for BufferedAmountLowNotificationRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("BufferedAmountLowNotificationRef"); - f.field("buffered_amount", &self.buffered_amount()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> - for BufferedAmountLowNotification - { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: BufferedAmountLowNotificationRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - buffered_amount: ::core::convert::TryInto::try_into( - value.buffered_amount()?, - )?, - }) - } - } - - impl<'a> ::planus::TableRead<'a> for BufferedAmountLowNotificationRef<'a> { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) - } - } - - impl<'a> ::planus::VectorReadInner<'a> for BufferedAmountLowNotificationRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { - error_kind.with_error_location( - "[BufferedAmountLowNotificationRef]", - "get", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite<::planus::Offset> - for BufferedAmountLowNotification - { - type Value = ::planus::Offset; - const STRIDE: usize = 4; - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) - } - - #[inline] - unsafe fn write_values( - values: &[::planus::Offset], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, - ); - } - } - } - - impl<'a> ::planus::ReadAsRoot<'a> for BufferedAmountLowNotificationRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location( - "[BufferedAmountLowNotificationRef]", - "read_as_root", - 0, - ) - }) - } - } - - /// The table `MessageNotification` in the namespace `FBS.DataConsumer` - /// - /// Generated from these locations: - /// * Table `MessageNotification` in the file `../worker/fbs/dataConsumer.fbs:69` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct MessageNotification { - /// The field `ppid` in the table `MessageNotification` - pub ppid: u32, - /// The field `data` in the table `MessageNotification` - pub data: ::planus::alloc::vec::Vec, - } - - impl MessageNotification { - /// Creates a [MessageNotificationBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> MessageNotificationBuilder<()> { - MessageNotificationBuilder(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_ppid: impl ::planus::WriteAsDefault, - field_data: impl ::planus::WriteAs<::planus::Offset<[u8]>>, - ) -> ::planus::Offset { - let prepared_ppid = field_ppid.prepare(builder, &0); - let prepared_data = field_data.prepare(builder); - - let mut table_writer: ::planus::table_writer::TableWriter<8> = - ::core::default::Default::default(); - if prepared_ppid.is_some() { - table_writer.write_entry::(0); - } - table_writer.write_entry::<::planus::Offset<[u8]>>(1); - - unsafe { - table_writer.finish(builder, |object_writer| { - if let ::core::option::Option::Some(prepared_ppid) = prepared_ppid { - object_writer.write::<_, _, 4>(&prepared_ppid); - } - object_writer.write::<_, _, 4>(&prepared_data); - }); - } - builder.current_offset() - } - } - - impl ::planus::WriteAs<::planus::Offset> for MessageNotification { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl ::planus::WriteAsOptional<::planus::Offset> for MessageNotification { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl ::planus::WriteAsOffset for MessageNotification { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - MessageNotification::create(builder, self.ppid, &self.data) - } - } - - /// Builder for serializing an instance of the [MessageNotification] type. - /// - /// Can be created using the [MessageNotification::builder] method. - #[derive(Debug)] - #[must_use] - pub struct MessageNotificationBuilder(State); - - impl MessageNotificationBuilder<()> { - /// Setter for the [`ppid` field](MessageNotification#structfield.ppid). - #[inline] - #[allow(clippy::type_complexity)] - pub fn ppid(self, value: T0) -> MessageNotificationBuilder<(T0,)> - where - T0: ::planus::WriteAsDefault, - { - MessageNotificationBuilder((value,)) - } - - /// Sets the [`ppid` field](MessageNotification#structfield.ppid) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn ppid_as_default( - self, - ) -> MessageNotificationBuilder<(::planus::DefaultValue,)> { - self.ppid(::planus::DefaultValue) - } - } - - impl MessageNotificationBuilder<(T0,)> { - /// Setter for the [`data` field](MessageNotification#structfield.data). - #[inline] - #[allow(clippy::type_complexity)] - pub fn data(self, value: T1) -> MessageNotificationBuilder<(T0, T1)> - where - T1: ::planus::WriteAs<::planus::Offset<[u8]>>, - { - let (v0,) = self.0; - MessageNotificationBuilder((v0, value)) - } - } - - impl MessageNotificationBuilder<(T0, T1)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [MessageNotification]. - #[inline] - pub fn finish( - self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset<[u8]>>, - > ::planus::WriteAs<::planus::Offset> - for MessageNotificationBuilder<(T0, T1)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset<[u8]>>, - > ::planus::WriteAsOptional<::planus::Offset> - for MessageNotificationBuilder<(T0, T1)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset<[u8]>>, - > ::planus::WriteAsOffset - for MessageNotificationBuilder<(T0, T1)> - { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0, v1) = &self.0; - MessageNotification::create(builder, v0, v1) - } - } - - /// Reference to a deserialized [MessageNotification]. - #[derive(Copy, Clone)] - pub struct MessageNotificationRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> MessageNotificationRef<'a> { - /// Getter for the [`ppid` field](MessageNotification#structfield.ppid). - #[inline] - pub fn ppid(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0 - .access(0, "MessageNotification", "ppid")? - .unwrap_or(0), - ) - } - - /// Getter for the [`data` field](MessageNotification#structfield.data). - #[inline] - pub fn data(&self) -> ::planus::Result<&'a [u8]> { - self.0.access_required(1, "MessageNotification", "data") - } - } - - impl<'a> ::core::fmt::Debug for MessageNotificationRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("MessageNotificationRef"); - f.field("ppid", &self.ppid()); - f.field("data", &self.data()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> for MessageNotification { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: MessageNotificationRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - ppid: ::core::convert::TryInto::try_into(value.ppid()?)?, - data: value.data()?.to_vec(), - }) - } - } - - impl<'a> ::planus::TableRead<'a> for MessageNotificationRef<'a> { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) - } - } - - impl<'a> ::planus::VectorReadInner<'a> for MessageNotificationRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { - error_kind.with_error_location( - "[MessageNotificationRef]", - "get", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite<::planus::Offset> for MessageNotification { - type Value = ::planus::Offset; - const STRIDE: usize = 4; - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) - } - - #[inline] - unsafe fn write_values( - values: &[::planus::Offset], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, - ); - } - } - } - - impl<'a> ::planus::ReadAsRoot<'a> for MessageNotificationRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location( - "[MessageNotificationRef]", - "read_as_root", - 0, - ) - }) - } - } - } - /// The namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * File `../worker/fbs/dataProducer.fbs` - pub mod data_producer { - /// The enum `Type` in the namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * Enum `Type` in the file `../worker/fbs/dataProducer.fbs:5` - #[derive( - Copy, - Clone, - Debug, - PartialEq, - Eq, - PartialOrd, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - #[repr(u8)] - pub enum Type { - /// The variant `SCTP` in the enum `Type` - Sctp = 0, - - /// The variant `DIRECT` in the enum `Type` - Direct = 1, - } - - impl Type { - /// Array containing all valid variants of Type - pub const ENUM_VALUES: [Self; 2] = [Self::Sctp, Self::Direct]; - } - - impl ::core::convert::TryFrom for Type { - type Error = ::planus::errors::UnknownEnumTagKind; - #[inline] - fn try_from( - value: u8, - ) -> ::core::result::Result - { - #[allow(clippy::match_single_binding)] - match value { - 0 => ::core::result::Result::Ok(Type::Sctp), - 1 => ::core::result::Result::Ok(Type::Direct), - - _ => ::core::result::Result::Err(::planus::errors::UnknownEnumTagKind { - tag: value as i128, - }), - } - } - } - - impl ::core::convert::From for u8 { - #[inline] - fn from(value: Type) -> Self { - value as u8 - } - } - - impl ::planus::Primitive for Type { - const ALIGNMENT: usize = 1; - const SIZE: usize = 1; - } - - impl ::planus::WriteAsPrimitive for Type { - #[inline] - fn write( - &self, - cursor: ::planus::Cursor<'_, N>, - buffer_position: u32, - ) { - (*self as u8).write(cursor, buffer_position); - } - } - - impl ::planus::WriteAs for Type { - type Prepared = Self; - - #[inline] - fn prepare(&self, _builder: &mut ::planus::Builder) -> Type { - *self - } - } - - impl ::planus::WriteAsDefault for Type { - type Prepared = Self; - - #[inline] - fn prepare( - &self, - _builder: &mut ::planus::Builder, - default: &Type, - ) -> ::core::option::Option { - if self == default { - ::core::option::Option::None - } else { - ::core::option::Option::Some(*self) - } - } - } - - impl ::planus::WriteAsOptional for Type { - type Prepared = Self; - - #[inline] - fn prepare( - &self, - _builder: &mut ::planus::Builder, - ) -> ::core::option::Option { - ::core::option::Option::Some(*self) - } - } - - impl<'buf> ::planus::TableRead<'buf> for Type { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'buf>, - offset: usize, - ) -> ::core::result::Result { - let n: u8 = ::planus::TableRead::from_buffer(buffer, offset)?; - ::core::result::Result::Ok(::core::convert::TryInto::try_into(n)?) - } - } - - impl<'buf> ::planus::VectorReadInner<'buf> for Type { - type Error = ::planus::errors::UnknownEnumTag; - const STRIDE: usize = 1; - #[inline] - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'buf>, - offset: usize, - ) -> ::core::result::Result - { - let value = *buffer.buffer.get_unchecked(offset); - let value: ::core::result::Result = - ::core::convert::TryInto::try_into(value); - value.map_err(|error_kind| { - error_kind.with_error_location( - "Type", - "VectorRead::from_buffer", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite for Type { - const STRIDE: usize = 1; - - type Value = Self; - - #[inline] - fn prepare(&self, _builder: &mut ::planus::Builder) -> Self { - *self - } - - #[inline] - unsafe fn write_values( - values: &[Self], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 1]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - i as u32, - ); - } - } - } - - /// The table `DumpResponse` in the namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * Table `DumpResponse` in the file `../worker/fbs/dataProducer.fbs:10` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct DumpResponse { - /// The field `id` in the table `DumpResponse` - pub id: ::planus::alloc::string::String, - /// The field `type` in the table `DumpResponse` - pub type_: self::Type, - /// The field `sctp_stream_parameters` in the table `DumpResponse` - pub sctp_stream_parameters: ::core::option::Option< - ::planus::alloc::boxed::Box, - >, - /// The field `label` in the table `DumpResponse` - pub label: ::planus::alloc::string::String, - /// The field `protocol` in the table `DumpResponse` - pub protocol: ::planus::alloc::string::String, - /// The field `paused` in the table `DumpResponse` - pub paused: bool, - } - - impl DumpResponse { - /// Creates a [DumpResponseBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> DumpResponseBuilder<()> { - DumpResponseBuilder(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_id: impl ::planus::WriteAs<::planus::Offset>, - field_type_: impl ::planus::WriteAsDefault, - field_sctp_stream_parameters: impl ::planus::WriteAsOptional< - ::planus::Offset, - >, - field_label: impl ::planus::WriteAs<::planus::Offset>, - field_protocol: impl ::planus::WriteAs<::planus::Offset>, - field_paused: impl ::planus::WriteAsDefault, - ) -> ::planus::Offset { - let prepared_id = field_id.prepare(builder); - let prepared_type_ = field_type_.prepare(builder, &self::Type::Sctp); - let prepared_sctp_stream_parameters = - field_sctp_stream_parameters.prepare(builder); - let prepared_label = field_label.prepare(builder); - let prepared_protocol = field_protocol.prepare(builder); - let prepared_paused = field_paused.prepare(builder, &false); - - let mut table_writer: ::planus::table_writer::TableWriter<16> = - ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset>(0); - if prepared_sctp_stream_parameters.is_some() { - table_writer.write_entry::<::planus::Offset>(2); - } - table_writer.write_entry::<::planus::Offset>(3); - table_writer.write_entry::<::planus::Offset>(4); - if prepared_type_.is_some() { - table_writer.write_entry::(1); - } - if prepared_paused.is_some() { - table_writer.write_entry::(5); - } - - unsafe { - table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_id); - if let ::core::option::Option::Some(prepared_sctp_stream_parameters) = - prepared_sctp_stream_parameters - { - object_writer.write::<_, _, 4>(&prepared_sctp_stream_parameters); - } - object_writer.write::<_, _, 4>(&prepared_label); - object_writer.write::<_, _, 4>(&prepared_protocol); - if let ::core::option::Option::Some(prepared_type_) = prepared_type_ { - object_writer.write::<_, _, 1>(&prepared_type_); - } - if let ::core::option::Option::Some(prepared_paused) = prepared_paused { - object_writer.write::<_, _, 1>(&prepared_paused); - } - }); - } - builder.current_offset() - } - } - - impl ::planus::WriteAs<::planus::Offset> for DumpResponse { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl ::planus::WriteAsOptional<::planus::Offset> for DumpResponse { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl ::planus::WriteAsOffset for DumpResponse { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - DumpResponse::create( - builder, - &self.id, - self.type_, - &self.sctp_stream_parameters, - &self.label, - &self.protocol, - self.paused, - ) - } - } - - /// Builder for serializing an instance of the [DumpResponse] type. - /// - /// Can be created using the [DumpResponse::builder] method. - #[derive(Debug)] - #[must_use] - pub struct DumpResponseBuilder(State); - - impl DumpResponseBuilder<()> { - /// Setter for the [`id` field](DumpResponse#structfield.id). - #[inline] - #[allow(clippy::type_complexity)] - pub fn id(self, value: T0) -> DumpResponseBuilder<(T0,)> - where - T0: ::planus::WriteAs<::planus::Offset>, - { - DumpResponseBuilder((value,)) - } - } - - impl DumpResponseBuilder<(T0,)> { - /// Setter for the [`type` field](DumpResponse#structfield.type_). - #[inline] - #[allow(clippy::type_complexity)] - pub fn type_(self, value: T1) -> DumpResponseBuilder<(T0, T1)> - where - T1: ::planus::WriteAsDefault, - { - let (v0,) = self.0; - DumpResponseBuilder((v0, value)) - } - - /// Sets the [`type` field](DumpResponse#structfield.type_) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn type_as_default(self) -> DumpResponseBuilder<(T0, ::planus::DefaultValue)> { - self.type_(::planus::DefaultValue) - } - } - - impl DumpResponseBuilder<(T0, T1)> { - /// Setter for the [`sctp_stream_parameters` field](DumpResponse#structfield.sctp_stream_parameters). - #[inline] - #[allow(clippy::type_complexity)] - pub fn sctp_stream_parameters( - self, - value: T2, - ) -> DumpResponseBuilder<(T0, T1, T2)> - where - T2: ::planus::WriteAsOptional< - ::planus::Offset, - >, - { - let (v0, v1) = self.0; - DumpResponseBuilder((v0, v1, value)) - } - - /// Sets the [`sctp_stream_parameters` field](DumpResponse#structfield.sctp_stream_parameters) to null. - #[inline] - #[allow(clippy::type_complexity)] - pub fn sctp_stream_parameters_as_null(self) -> DumpResponseBuilder<(T0, T1, ())> { - self.sctp_stream_parameters(()) - } - } - - impl DumpResponseBuilder<(T0, T1, T2)> { - /// Setter for the [`label` field](DumpResponse#structfield.label). - #[inline] - #[allow(clippy::type_complexity)] - pub fn label(self, value: T3) -> DumpResponseBuilder<(T0, T1, T2, T3)> - where - T3: ::planus::WriteAs<::planus::Offset>, - { - let (v0, v1, v2) = self.0; - DumpResponseBuilder((v0, v1, v2, value)) - } - } - - impl DumpResponseBuilder<(T0, T1, T2, T3)> { - /// Setter for the [`protocol` field](DumpResponse#structfield.protocol). - #[inline] - #[allow(clippy::type_complexity)] - pub fn protocol(self, value: T4) -> DumpResponseBuilder<(T0, T1, T2, T3, T4)> - where - T4: ::planus::WriteAs<::planus::Offset>, - { - let (v0, v1, v2, v3) = self.0; - DumpResponseBuilder((v0, v1, v2, v3, value)) - } - } - - impl DumpResponseBuilder<(T0, T1, T2, T3, T4)> { - /// Setter for the [`paused` field](DumpResponse#structfield.paused). - #[inline] - #[allow(clippy::type_complexity)] - pub fn paused(self, value: T5) -> DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> - where - T5: ::planus::WriteAsDefault, - { - let (v0, v1, v2, v3, v4) = self.0; - DumpResponseBuilder((v0, v1, v2, v3, v4, value)) - } - - /// Sets the [`paused` field](DumpResponse#structfield.paused) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn paused_as_default( - self, - ) -> DumpResponseBuilder<(T0, T1, T2, T3, T4, ::planus::DefaultValue)> - { - self.paused(::planus::DefaultValue) - } - } - - impl DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [DumpResponse]. - #[inline] - pub fn finish( - self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) - } - } - - impl< - T0: ::planus::WriteAs<::planus::Offset>, - T1: ::planus::WriteAsDefault, - T2: ::planus::WriteAsOptional< - ::planus::Offset, - >, - T3: ::planus::WriteAs<::planus::Offset>, - T4: ::planus::WriteAs<::planus::Offset>, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAs<::planus::Offset> - for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl< - T0: ::planus::WriteAs<::planus::Offset>, - T1: ::planus::WriteAsDefault, - T2: ::planus::WriteAsOptional< - ::planus::Offset, - >, - T3: ::planus::WriteAs<::planus::Offset>, - T4: ::planus::WriteAs<::planus::Offset>, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAsOptional<::planus::Offset> - for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl< - T0: ::planus::WriteAs<::planus::Offset>, - T1: ::planus::WriteAsDefault, - T2: ::planus::WriteAsOptional< - ::planus::Offset, - >, - T3: ::planus::WriteAs<::planus::Offset>, - T4: ::planus::WriteAs<::planus::Offset>, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAsOffset - for DumpResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0, v1, v2, v3, v4, v5) = &self.0; - DumpResponse::create(builder, v0, v1, v2, v3, v4, v5) - } - } - - /// Reference to a deserialized [DumpResponse]. - #[derive(Copy, Clone)] - pub struct DumpResponseRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> DumpResponseRef<'a> { - /// Getter for the [`id` field](DumpResponse#structfield.id). - #[inline] - pub fn id(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(0, "DumpResponse", "id") - } - - /// Getter for the [`type` field](DumpResponse#structfield.type_). - #[inline] - pub fn type_(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0 - .access(1, "DumpResponse", "type_")? - .unwrap_or(self::Type::Sctp), + .access(1, "DumpResponse", "type_")? + .unwrap_or(self::Type::Sctp), ) } /// Getter for the [`sctp_stream_parameters` field](DumpResponse#structfield.sctp_stream_parameters). #[inline] - pub fn sctp_stream_parameters( - &self, - ) -> ::planus::Result< - ::core::option::Option>, - > { - self.0.access(2, "DumpResponse", "sctp_stream_parameters") - } - - /// Getter for the [`label` field](DumpResponse#structfield.label). - #[inline] - pub fn label(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(3, "DumpResponse", "label") - } - - /// Getter for the [`protocol` field](DumpResponse#structfield.protocol). - #[inline] - pub fn protocol(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(4, "DumpResponse", "protocol") - } - - /// Getter for the [`paused` field](DumpResponse#structfield.paused). - #[inline] - pub fn paused(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0.access(5, "DumpResponse", "paused")?.unwrap_or(false), - ) - } - } - - impl<'a> ::core::fmt::Debug for DumpResponseRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("DumpResponseRef"); - f.field("id", &self.id()); - f.field("type_", &self.type_()); - if let ::core::option::Option::Some(field_sctp_stream_parameters) = - self.sctp_stream_parameters().transpose() - { - f.field("sctp_stream_parameters", &field_sctp_stream_parameters); - } - f.field("label", &self.label()); - f.field("protocol", &self.protocol()); - f.field("paused", &self.paused()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> for DumpResponse { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: DumpResponseRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - id: ::core::convert::TryInto::try_into(value.id()?)?, - type_: ::core::convert::TryInto::try_into(value.type_()?)?, - sctp_stream_parameters: if let ::core::option::Option::Some( - sctp_stream_parameters, - ) = value.sctp_stream_parameters()? - { - ::core::option::Option::Some(::planus::alloc::boxed::Box::new( - ::core::convert::TryInto::try_into(sctp_stream_parameters)?, - )) - } else { - ::core::option::Option::None - }, - label: ::core::convert::TryInto::try_into(value.label()?)?, - protocol: ::core::convert::TryInto::try_into(value.protocol()?)?, - paused: ::core::convert::TryInto::try_into(value.paused()?)?, - }) - } - } - - impl<'a> ::planus::TableRead<'a> for DumpResponseRef<'a> { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) - } - } - - impl<'a> ::planus::VectorReadInner<'a> for DumpResponseRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { - error_kind.with_error_location( - "[DumpResponseRef]", - "get", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite<::planus::Offset> for DumpResponse { - type Value = ::planus::Offset; - const STRIDE: usize = 4; - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) - } - - #[inline] - unsafe fn write_values( - values: &[::planus::Offset], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, - ); - } - } - } - - impl<'a> ::planus::ReadAsRoot<'a> for DumpResponseRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location("[DumpResponseRef]", "read_as_root", 0) - }) - } - } - - /// The table `GetStatsResponse` in the namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * Table `GetStatsResponse` in the file `../worker/fbs/dataProducer.fbs:19` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct GetStatsResponse { - /// The field `timestamp` in the table `GetStatsResponse` - pub timestamp: u64, - /// The field `label` in the table `GetStatsResponse` - pub label: ::planus::alloc::string::String, - /// The field `protocol` in the table `GetStatsResponse` - pub protocol: ::planus::alloc::string::String, - /// The field `messages_received` in the table `GetStatsResponse` - pub messages_received: u64, - /// The field `bytes_received` in the table `GetStatsResponse` - pub bytes_received: u64, - /// The field `buffered_amount` in the table `GetStatsResponse` - pub buffered_amount: u32, - } - - impl GetStatsResponse { - /// Creates a [GetStatsResponseBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> GetStatsResponseBuilder<()> { - GetStatsResponseBuilder(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_timestamp: impl ::planus::WriteAsDefault, - field_label: impl ::planus::WriteAs<::planus::Offset>, - field_protocol: impl ::planus::WriteAs<::planus::Offset>, - field_messages_received: impl ::planus::WriteAsDefault, - field_bytes_received: impl ::planus::WriteAsDefault, - field_buffered_amount: impl ::planus::WriteAsDefault, - ) -> ::planus::Offset { - let prepared_timestamp = field_timestamp.prepare(builder, &0); - let prepared_label = field_label.prepare(builder); - let prepared_protocol = field_protocol.prepare(builder); - let prepared_messages_received = field_messages_received.prepare(builder, &0); - let prepared_bytes_received = field_bytes_received.prepare(builder, &0); - let prepared_buffered_amount = field_buffered_amount.prepare(builder, &0); - - let mut table_writer: ::planus::table_writer::TableWriter<16> = - ::core::default::Default::default(); - if prepared_timestamp.is_some() { - table_writer.write_entry::(0); - } - if prepared_messages_received.is_some() { - table_writer.write_entry::(3); - } - if prepared_bytes_received.is_some() { - table_writer.write_entry::(4); - } - table_writer.write_entry::<::planus::Offset>(1); - table_writer.write_entry::<::planus::Offset>(2); - if prepared_buffered_amount.is_some() { - table_writer.write_entry::(5); - } - - unsafe { - table_writer.finish(builder, |object_writer| { - if let ::core::option::Option::Some(prepared_timestamp) = - prepared_timestamp - { - object_writer.write::<_, _, 8>(&prepared_timestamp); - } - if let ::core::option::Option::Some(prepared_messages_received) = - prepared_messages_received - { - object_writer.write::<_, _, 8>(&prepared_messages_received); - } - if let ::core::option::Option::Some(prepared_bytes_received) = - prepared_bytes_received - { - object_writer.write::<_, _, 8>(&prepared_bytes_received); - } - object_writer.write::<_, _, 4>(&prepared_label); - object_writer.write::<_, _, 4>(&prepared_protocol); - if let ::core::option::Option::Some(prepared_buffered_amount) = - prepared_buffered_amount - { - object_writer.write::<_, _, 4>(&prepared_buffered_amount); - } - }); - } - builder.current_offset() - } - } - - impl ::planus::WriteAs<::planus::Offset> for GetStatsResponse { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl ::planus::WriteAsOptional<::planus::Offset> for GetStatsResponse { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl ::planus::WriteAsOffset for GetStatsResponse { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - GetStatsResponse::create( - builder, - self.timestamp, - &self.label, - &self.protocol, - self.messages_received, - self.bytes_received, - self.buffered_amount, - ) - } - } - - /// Builder for serializing an instance of the [GetStatsResponse] type. - /// - /// Can be created using the [GetStatsResponse::builder] method. - #[derive(Debug)] - #[must_use] - pub struct GetStatsResponseBuilder(State); - - impl GetStatsResponseBuilder<()> { - /// Setter for the [`timestamp` field](GetStatsResponse#structfield.timestamp). - #[inline] - #[allow(clippy::type_complexity)] - pub fn timestamp(self, value: T0) -> GetStatsResponseBuilder<(T0,)> - where - T0: ::planus::WriteAsDefault, - { - GetStatsResponseBuilder((value,)) - } - - /// Sets the [`timestamp` field](GetStatsResponse#structfield.timestamp) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn timestamp_as_default( - self, - ) -> GetStatsResponseBuilder<(::planus::DefaultValue,)> { - self.timestamp(::planus::DefaultValue) - } - } - - impl GetStatsResponseBuilder<(T0,)> { - /// Setter for the [`label` field](GetStatsResponse#structfield.label). - #[inline] - #[allow(clippy::type_complexity)] - pub fn label(self, value: T1) -> GetStatsResponseBuilder<(T0, T1)> - where - T1: ::planus::WriteAs<::planus::Offset>, - { - let (v0,) = self.0; - GetStatsResponseBuilder((v0, value)) - } - } - - impl GetStatsResponseBuilder<(T0, T1)> { - /// Setter for the [`protocol` field](GetStatsResponse#structfield.protocol). - #[inline] - #[allow(clippy::type_complexity)] - pub fn protocol(self, value: T2) -> GetStatsResponseBuilder<(T0, T1, T2)> - where - T2: ::planus::WriteAs<::planus::Offset>, - { - let (v0, v1) = self.0; - GetStatsResponseBuilder((v0, v1, value)) - } - } - - impl GetStatsResponseBuilder<(T0, T1, T2)> { - /// Setter for the [`messages_received` field](GetStatsResponse#structfield.messages_received). - #[inline] - #[allow(clippy::type_complexity)] - pub fn messages_received( - self, - value: T3, - ) -> GetStatsResponseBuilder<(T0, T1, T2, T3)> - where - T3: ::planus::WriteAsDefault, - { - let (v0, v1, v2) = self.0; - GetStatsResponseBuilder((v0, v1, v2, value)) - } - - /// Sets the [`messages_received` field](GetStatsResponse#structfield.messages_received) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn messages_received_as_default( - self, - ) -> GetStatsResponseBuilder<(T0, T1, T2, ::planus::DefaultValue)> { - self.messages_received(::planus::DefaultValue) - } - } - - impl GetStatsResponseBuilder<(T0, T1, T2, T3)> { - /// Setter for the [`bytes_received` field](GetStatsResponse#structfield.bytes_received). - #[inline] - #[allow(clippy::type_complexity)] - pub fn bytes_received( - self, - value: T4, - ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4)> - where - T4: ::planus::WriteAsDefault, - { - let (v0, v1, v2, v3) = self.0; - GetStatsResponseBuilder((v0, v1, v2, v3, value)) - } - - /// Sets the [`bytes_received` field](GetStatsResponse#structfield.bytes_received) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn bytes_received_as_default( - self, - ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, ::planus::DefaultValue)> - { - self.bytes_received(::planus::DefaultValue) - } - } - - impl GetStatsResponseBuilder<(T0, T1, T2, T3, T4)> { - /// Setter for the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount). - #[inline] - #[allow(clippy::type_complexity)] - pub fn buffered_amount( - self, - value: T5, - ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> - where - T5: ::planus::WriteAsDefault, - { - let (v0, v1, v2, v3, v4) = self.0; - GetStatsResponseBuilder((v0, v1, v2, v3, v4, value)) - } - - /// Sets the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount) to the default value. - #[inline] - #[allow(clippy::type_complexity)] - pub fn buffered_amount_as_default( - self, - ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4, ::planus::DefaultValue)> - { - self.buffered_amount(::planus::DefaultValue) - } - } - - impl GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [GetStatsResponse]. - #[inline] - pub fn finish( - self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset>, - T2: ::planus::WriteAs<::planus::Offset>, - T3: ::planus::WriteAsDefault, - T4: ::planus::WriteAsDefault, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAs<::planus::Offset> - for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset>, - T2: ::planus::WriteAs<::planus::Offset>, - T3: ::planus::WriteAsDefault, - T4: ::planus::WriteAsDefault, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAsOptional<::planus::Offset> - for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl< - T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAs<::planus::Offset>, - T2: ::planus::WriteAs<::planus::Offset>, - T3: ::planus::WriteAsDefault, - T4: ::planus::WriteAsDefault, - T5: ::planus::WriteAsDefault, - > ::planus::WriteAsOffset - for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> - { - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::planus::Offset { - let (v0, v1, v2, v3, v4, v5) = &self.0; - GetStatsResponse::create(builder, v0, v1, v2, v3, v4, v5) - } - } - - /// Reference to a deserialized [GetStatsResponse]. - #[derive(Copy, Clone)] - pub struct GetStatsResponseRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> GetStatsResponseRef<'a> { - /// Getter for the [`timestamp` field](GetStatsResponse#structfield.timestamp). - #[inline] - pub fn timestamp(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0 - .access(0, "GetStatsResponse", "timestamp")? - .unwrap_or(0), - ) + pub fn sctp_stream_parameters( + &self, + ) -> ::planus::Result< + ::core::option::Option>, + > { + self.0.access(2, "DumpResponse", "sctp_stream_parameters") } - /// Getter for the [`label` field](GetStatsResponse#structfield.label). + /// Getter for the [`label` field](DumpResponse#structfield.label). #[inline] pub fn label(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(1, "GetStatsResponse", "label") + self.0.access_required(3, "DumpResponse", "label") } - /// Getter for the [`protocol` field](GetStatsResponse#structfield.protocol). + /// Getter for the [`protocol` field](DumpResponse#structfield.protocol). #[inline] pub fn protocol(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(2, "GetStatsResponse", "protocol") - } - - /// Getter for the [`messages_received` field](GetStatsResponse#structfield.messages_received). - #[inline] - pub fn messages_received(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0 - .access(3, "GetStatsResponse", "messages_received")? - .unwrap_or(0), - ) - } - - /// Getter for the [`bytes_received` field](GetStatsResponse#structfield.bytes_received). - #[inline] - pub fn bytes_received(&self) -> ::planus::Result { - ::core::result::Result::Ok( - self.0 - .access(4, "GetStatsResponse", "bytes_received")? - .unwrap_or(0), - ) + self.0.access_required(4, "DumpResponse", "protocol") } - /// Getter for the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount). + /// Getter for the [`paused` field](DumpResponse#structfield.paused). #[inline] - pub fn buffered_amount(&self) -> ::planus::Result { + pub fn paused(&self) -> ::planus::Result { ::core::result::Result::Ok( - self.0 - .access(5, "GetStatsResponse", "buffered_amount")? - .unwrap_or(0), + self.0.access(5, "DumpResponse", "paused")?.unwrap_or(false), ) } } - impl<'a> ::core::fmt::Debug for GetStatsResponseRef<'a> { + impl<'a> ::core::fmt::Debug for DumpResponseRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("GetStatsResponseRef"); - f.field("timestamp", &self.timestamp()); + let mut f = f.debug_struct("DumpResponseRef"); + f.field("id", &self.id()); + f.field("type_", &self.type_()); + if let ::core::option::Option::Some(field_sctp_stream_parameters) = + self.sctp_stream_parameters().transpose() + { + f.field("sctp_stream_parameters", &field_sctp_stream_parameters); + } f.field("label", &self.label()); f.field("protocol", &self.protocol()); - f.field("messages_received", &self.messages_received()); - f.field("bytes_received", &self.bytes_received()); - f.field("buffered_amount", &self.buffered_amount()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> for GetStatsResponse { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: GetStatsResponseRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - timestamp: ::core::convert::TryInto::try_into(value.timestamp()?)?, - label: ::core::convert::TryInto::try_into(value.label()?)?, - protocol: ::core::convert::TryInto::try_into(value.protocol()?)?, - messages_received: ::core::convert::TryInto::try_into( - value.messages_received()?, - )?, - bytes_received: ::core::convert::TryInto::try_into( - value.bytes_received()?, - )?, - buffered_amount: ::core::convert::TryInto::try_into( - value.buffered_amount()?, - )?, - }) - } - } - - impl<'a> ::planus::TableRead<'a> for GetStatsResponseRef<'a> { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) - } - } - - impl<'a> ::planus::VectorReadInner<'a> for GetStatsResponseRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { - error_kind.with_error_location( - "[GetStatsResponseRef]", - "get", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite<::planus::Offset> for GetStatsResponse { - type Value = ::planus::Offset; - const STRIDE: usize = 4; - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) - } - - #[inline] - unsafe fn write_values( - values: &[::planus::Offset], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, - ); - } - } - } - - impl<'a> ::planus::ReadAsRoot<'a> for GetStatsResponseRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location("[GetStatsResponseRef]", "read_as_root", 0) - }) - } - } - - /// The table `String` in the namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * Table `String` in the file `../worker/fbs/dataProducer.fbs:28` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct String { - /// The field `value` in the table `String` - pub value: ::planus::alloc::string::String, - } - - impl String { - /// Creates a [StringBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> StringBuilder<()> { - StringBuilder(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_value: impl ::planus::WriteAs<::planus::Offset>, - ) -> ::planus::Offset { - let prepared_value = field_value.prepare(builder); - - let mut table_writer: ::planus::table_writer::TableWriter<6> = - ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset>(0); - - unsafe { - table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_value); - }); - } - builder.current_offset() - } - } - - impl ::planus::WriteAs<::planus::Offset> for String { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl ::planus::WriteAsOptional<::planus::Offset> for String { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl ::planus::WriteAsOffset for String { - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - String::create(builder, &self.value) - } - } - - /// Builder for serializing an instance of the [String] type. - /// - /// Can be created using the [String::builder] method. - #[derive(Debug)] - #[must_use] - pub struct StringBuilder(State); - - impl StringBuilder<()> { - /// Setter for the [`value` field](String#structfield.value). - #[inline] - #[allow(clippy::type_complexity)] - pub fn value(self, value: T0) -> StringBuilder<(T0,)> - where - T0: ::planus::WriteAs<::planus::Offset>, - { - StringBuilder((value,)) - } - } - - impl StringBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [String]. - #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) - } - } - - impl>> - ::planus::WriteAs<::planus::Offset> for StringBuilder<(T0,)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl>> - ::planus::WriteAsOptional<::planus::Offset> for StringBuilder<(T0,)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl>> ::planus::WriteAsOffset - for StringBuilder<(T0,)> - { - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - let (v0,) = &self.0; - String::create(builder, v0) - } - } - - /// Reference to a deserialized [String]. - #[derive(Copy, Clone)] - pub struct StringRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> StringRef<'a> { - /// Getter for the [`value` field](String#structfield.value). - #[inline] - pub fn value(&self) -> ::planus::Result<&'a ::core::primitive::str> { - self.0.access_required(0, "String", "value") - } - } - - impl<'a> ::core::fmt::Debug for StringRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("StringRef"); - f.field("value", &self.value()); - f.finish() - } - } - - impl<'a> ::core::convert::TryFrom> for String { - type Error = ::planus::Error; - - #[allow(unreachable_code)] - fn try_from(value: StringRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(Self { - value: ::core::convert::TryInto::try_into(value.value()?)?, - }) - } - } - - impl<'a> ::planus::TableRead<'a> for StringRef<'a> { - #[inline] - fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::core::result::Result { - ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( - buffer, offset, - )?)) - } - } - - impl<'a> ::planus::VectorReadInner<'a> for StringRef<'a> { - type Error = ::planus::Error; - const STRIDE: usize = 4; - - unsafe fn from_buffer( - buffer: ::planus::SliceWithStartOffset<'a>, - offset: usize, - ) -> ::planus::Result { - ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { - error_kind.with_error_location( - "[StringRef]", - "get", - buffer.offset_from_start, - ) - }) - } - } - - impl ::planus::VectorWrite<::planus::Offset> for String { - type Value = ::planus::Offset; - const STRIDE: usize = 4; - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { - ::planus::WriteAs::prepare(self, builder) - } - - #[inline] - unsafe fn write_values( - values: &[::planus::Offset], - bytes: *mut ::core::mem::MaybeUninit, - buffer_position: u32, - ) { - let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; - for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { - ::planus::WriteAsPrimitive::write( - v, - ::planus::Cursor::new(&mut *bytes.add(i)), - buffer_position - (Self::STRIDE * i) as u32, - ); - } - } - } - - impl<'a> ::planus::ReadAsRoot<'a> for StringRef<'a> { - fn read_as_root(slice: &'a [u8]) -> ::planus::Result { - ::planus::TableRead::from_buffer( - ::planus::SliceWithStartOffset { - buffer: slice, - offset_from_start: 0, - }, - 0, - ) - .map_err(|error_kind| { - error_kind.with_error_location("[StringRef]", "read_as_root", 0) - }) - } - } - - /// The table `Binary` in the namespace `FBS.DataProducer` - /// - /// Generated from these locations: - /// * Table `Binary` in the file `../worker/fbs/dataProducer.fbs:32` - #[derive( - Clone, - Debug, - PartialEq, - PartialOrd, - Eq, - Ord, - Hash, - ::serde::Serialize, - ::serde::Deserialize, - )] - pub struct Binary { - /// The field `value` in the table `Binary` - pub value: ::planus::alloc::vec::Vec, - } - - impl Binary { - /// Creates a [BinaryBuilder] for serializing an instance of this table. - #[inline] - pub fn builder() -> BinaryBuilder<()> { - BinaryBuilder(()) - } - - #[allow(clippy::too_many_arguments)] - pub fn create( - builder: &mut ::planus::Builder, - field_value: impl ::planus::WriteAs<::planus::Offset<[u8]>>, - ) -> ::planus::Offset { - let prepared_value = field_value.prepare(builder); - - let mut table_writer: ::planus::table_writer::TableWriter<6> = - ::core::default::Default::default(); - table_writer.write_entry::<::planus::Offset<[u8]>>(0); - - unsafe { - table_writer.finish(builder, |object_writer| { - object_writer.write::<_, _, 4>(&prepared_value); - }); - } - builder.current_offset() - } - } - - impl ::planus::WriteAs<::planus::Offset> for Binary { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl ::planus::WriteAsOptional<::planus::Offset> for Binary { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl ::planus::WriteAsOffset for Binary { - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - Binary::create(builder, &self.value) - } - } - - /// Builder for serializing an instance of the [Binary] type. - /// - /// Can be created using the [Binary::builder] method. - #[derive(Debug)] - #[must_use] - pub struct BinaryBuilder(State); - - impl BinaryBuilder<()> { - /// Setter for the [`value` field](Binary#structfield.value). - #[inline] - #[allow(clippy::type_complexity)] - pub fn value(self, value: T0) -> BinaryBuilder<(T0,)> - where - T0: ::planus::WriteAs<::planus::Offset<[u8]>>, - { - BinaryBuilder((value,)) - } - } - - impl BinaryBuilder<(T0,)> { - /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [Binary]. - #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::Offset - where - Self: ::planus::WriteAsOffset, - { - ::planus::WriteAsOffset::prepare(&self, builder) - } - } - - impl>> - ::planus::WriteAs<::planus::Offset> for BinaryBuilder<(T0,)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - ::planus::WriteAsOffset::prepare(self, builder) - } - } - - impl>> - ::planus::WriteAsOptional<::planus::Offset> for BinaryBuilder<(T0,)> - { - type Prepared = ::planus::Offset; - - #[inline] - fn prepare( - &self, - builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::Offset> { - ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) - } - } - - impl>> ::planus::WriteAsOffset - for BinaryBuilder<(T0,)> - { - #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - let (v0,) = &self.0; - Binary::create(builder, v0) - } - } - - /// Reference to a deserialized [Binary]. - #[derive(Copy, Clone)] - pub struct BinaryRef<'a>(::planus::table_reader::Table<'a>); - - impl<'a> BinaryRef<'a> { - /// Getter for the [`value` field](Binary#structfield.value). - #[inline] - pub fn value(&self) -> ::planus::Result<&'a [u8]> { - self.0.access_required(0, "Binary", "value") - } - } - - impl<'a> ::core::fmt::Debug for BinaryRef<'a> { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - let mut f = f.debug_struct("BinaryRef"); - f.field("value", &self.value()); + f.field("paused", &self.paused()); f.finish() } } - impl<'a> ::core::convert::TryFrom> for Binary { + impl<'a> ::core::convert::TryFrom> for DumpResponse { type Error = ::planus::Error; #[allow(unreachable_code)] - fn try_from(value: BinaryRef<'a>) -> ::planus::Result { + fn try_from(value: DumpResponseRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - value: value.value()?.to_vec(), + id: ::core::convert::TryInto::try_into(value.id()?)?, + type_: ::core::convert::TryInto::try_into(value.type_()?)?, + sctp_stream_parameters: if let ::core::option::Option::Some( + sctp_stream_parameters, + ) = value.sctp_stream_parameters()? + { + ::core::option::Option::Some(::planus::alloc::boxed::Box::new( + ::core::convert::TryInto::try_into(sctp_stream_parameters)?, + )) + } else { + ::core::option::Option::None + }, + label: ::core::convert::TryInto::try_into(value.label()?)?, + protocol: ::core::convert::TryInto::try_into(value.protocol()?)?, + paused: ::core::convert::TryInto::try_into(value.paused()?)?, }) } } - impl<'a> ::planus::TableRead<'a> for BinaryRef<'a> { + impl<'a> ::planus::TableRead<'a> for DumpResponseRef<'a> { #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, @@ -29075,7 +27403,7 @@ mod root { } } - impl<'a> ::planus::VectorReadInner<'a> for BinaryRef<'a> { + impl<'a> ::planus::VectorReadInner<'a> for DumpResponseRef<'a> { type Error = ::planus::Error; const STRIDE: usize = 4; @@ -29085,7 +27413,7 @@ mod root { ) -> ::planus::Result { ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { error_kind.with_error_location( - "[BinaryRef]", + "[DumpResponseRef]", "get", buffer.offset_from_start, ) @@ -29093,8 +27421,8 @@ mod root { } } - impl ::planus::VectorWrite<::planus::Offset> for Binary { - type Value = ::planus::Offset; + impl ::planus::VectorWrite<::planus::Offset> for DumpResponse { + type Value = ::planus::Offset; const STRIDE: usize = 4; #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { @@ -29103,7 +27431,7 @@ mod root { #[inline] unsafe fn write_values( - values: &[::planus::Offset], + values: &[::planus::Offset], bytes: *mut ::core::mem::MaybeUninit, buffer_position: u32, ) { @@ -29118,7 +27446,7 @@ mod root { } } - impl<'a> ::planus::ReadAsRoot<'a> for BinaryRef<'a> { + impl<'a> ::planus::ReadAsRoot<'a> for DumpResponseRef<'a> { fn read_as_root(slice: &'a [u8]) -> ::planus::Result { ::planus::TableRead::from_buffer( ::planus::SliceWithStartOffset { @@ -29128,15 +27456,15 @@ mod root { 0, ) .map_err(|error_kind| { - error_kind.with_error_location("[BinaryRef]", "read_as_root", 0) + error_kind.with_error_location("[DumpResponseRef]", "read_as_root", 0) }) } } - /// The union `Data` in the namespace `FBS.DataProducer` + /// The table `GetStatsResponse` in the namespace `FBS.DataProducer` /// /// Generated from these locations: - /// * Union `Data` in the file `../worker/fbs/dataProducer.fbs:36` + /// * Table `GetStatsResponse` in the file `../worker/fbs/dataProducer.fbs:19` #[derive( Clone, Debug, @@ -29148,188 +27476,508 @@ mod root { ::serde::Serialize, ::serde::Deserialize, )] - pub enum Data { - /// The variant of type `String` in the union `Data` - String(::planus::alloc::boxed::Box), - - /// The variant of type `Binary` in the union `Data` - Binary(::planus::alloc::boxed::Box), + pub struct GetStatsResponse { + /// The field `timestamp` in the table `GetStatsResponse` + pub timestamp: u64, + /// The field `label` in the table `GetStatsResponse` + pub label: ::planus::alloc::string::String, + /// The field `protocol` in the table `GetStatsResponse` + pub protocol: ::planus::alloc::string::String, + /// The field `messages_received` in the table `GetStatsResponse` + pub messages_received: u64, + /// The field `bytes_received` in the table `GetStatsResponse` + pub bytes_received: u64, + /// The field `buffered_amount` in the table `GetStatsResponse` + pub buffered_amount: u32, } - impl Data { - /// Creates a [DataBuilder] for serializing an instance of this table. + impl GetStatsResponse { + /// Creates a [GetStatsResponseBuilder] for serializing an instance of this table. #[inline] - pub fn builder() -> DataBuilder<::planus::Uninitialized> { - DataBuilder(::planus::Uninitialized) + pub fn builder() -> GetStatsResponseBuilder<()> { + GetStatsResponseBuilder(()) } - #[inline] - pub fn create_string( + #[allow(clippy::too_many_arguments)] + pub fn create( builder: &mut ::planus::Builder, - value: impl ::planus::WriteAsOffset, - ) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(1, value.prepare(builder).downcast()) + field_timestamp: impl ::planus::WriteAsDefault, + field_label: impl ::planus::WriteAs<::planus::Offset>, + field_protocol: impl ::planus::WriteAs<::planus::Offset>, + field_messages_received: impl ::planus::WriteAsDefault, + field_bytes_received: impl ::planus::WriteAsDefault, + field_buffered_amount: impl ::planus::WriteAsDefault, + ) -> ::planus::Offset { + let prepared_timestamp = field_timestamp.prepare(builder, &0); + let prepared_label = field_label.prepare(builder); + let prepared_protocol = field_protocol.prepare(builder); + let prepared_messages_received = field_messages_received.prepare(builder, &0); + let prepared_bytes_received = field_bytes_received.prepare(builder, &0); + let prepared_buffered_amount = field_buffered_amount.prepare(builder, &0); + + let mut table_writer: ::planus::table_writer::TableWriter<16> = + ::core::default::Default::default(); + if prepared_timestamp.is_some() { + table_writer.write_entry::(0); + } + if prepared_messages_received.is_some() { + table_writer.write_entry::(3); + } + if prepared_bytes_received.is_some() { + table_writer.write_entry::(4); + } + table_writer.write_entry::<::planus::Offset>(1); + table_writer.write_entry::<::planus::Offset>(2); + if prepared_buffered_amount.is_some() { + table_writer.write_entry::(5); + } + + unsafe { + table_writer.finish(builder, |object_writer| { + if let ::core::option::Option::Some(prepared_timestamp) = + prepared_timestamp + { + object_writer.write::<_, _, 8>(&prepared_timestamp); + } + if let ::core::option::Option::Some(prepared_messages_received) = + prepared_messages_received + { + object_writer.write::<_, _, 8>(&prepared_messages_received); + } + if let ::core::option::Option::Some(prepared_bytes_received) = + prepared_bytes_received + { + object_writer.write::<_, _, 8>(&prepared_bytes_received); + } + object_writer.write::<_, _, 4>(&prepared_label); + object_writer.write::<_, _, 4>(&prepared_protocol); + if let ::core::option::Option::Some(prepared_buffered_amount) = + prepared_buffered_amount + { + object_writer.write::<_, _, 4>(&prepared_buffered_amount); + } + }); + } + builder.current_offset() } + } + + impl ::planus::WriteAs<::planus::Offset> for GetStatsResponse { + type Prepared = ::planus::Offset; #[inline] - pub fn create_binary( + fn prepare( + &self, builder: &mut ::planus::Builder, - value: impl ::planus::WriteAsOffset, - ) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(2, value.prepare(builder).downcast()) + ) -> ::planus::Offset { + ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsUnion for Data { + impl ::planus::WriteAsOptional<::planus::Offset> for GetStatsResponse { + type Prepared = ::planus::Offset; + #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - match self { - Self::String(value) => Self::create_string(builder, value), - Self::Binary(value) => Self::create_binary(builder, value), - } + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::core::option::Option<::planus::Offset> { + ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOptionalUnion for Data { + impl ::planus::WriteAsOffset for GetStatsResponse { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + GetStatsResponse::create( + builder, + self.timestamp, + &self.label, + &self.protocol, + self.messages_received, + self.bytes_received, + self.buffered_amount, + ) } } - /// Builder for serializing an instance of the [Data] type. + /// Builder for serializing an instance of the [GetStatsResponse] type. /// - /// Can be created using the [Data::builder] method. + /// Can be created using the [GetStatsResponse::builder] method. #[derive(Debug)] #[must_use] - pub struct DataBuilder(T); + pub struct GetStatsResponseBuilder(State); - impl DataBuilder<::planus::Uninitialized> { - /// Creates an instance of the [`String` variant](Data#variant.String). + impl GetStatsResponseBuilder<()> { + /// Setter for the [`timestamp` field](GetStatsResponse#structfield.timestamp). #[inline] - pub fn string(self, value: T) -> DataBuilder<::planus::Initialized<1, T>> + #[allow(clippy::type_complexity)] + pub fn timestamp(self, value: T0) -> GetStatsResponseBuilder<(T0,)> where - T: ::planus::WriteAsOffset, + T0: ::planus::WriteAsDefault, { - DataBuilder(::planus::Initialized(value)) + GetStatsResponseBuilder((value,)) + } + + /// Sets the [`timestamp` field](GetStatsResponse#structfield.timestamp) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn timestamp_as_default( + self, + ) -> GetStatsResponseBuilder<(::planus::DefaultValue,)> { + self.timestamp(::planus::DefaultValue) } + } - /// Creates an instance of the [`Binary` variant](Data#variant.Binary). + impl GetStatsResponseBuilder<(T0,)> { + /// Setter for the [`label` field](GetStatsResponse#structfield.label). #[inline] - pub fn binary(self, value: T) -> DataBuilder<::planus::Initialized<2, T>> + #[allow(clippy::type_complexity)] + pub fn label(self, value: T1) -> GetStatsResponseBuilder<(T0, T1)> where - T: ::planus::WriteAsOffset, + T1: ::planus::WriteAs<::planus::Offset>, { - DataBuilder(::planus::Initialized(value)) + let (v0,) = self.0; + GetStatsResponseBuilder((v0, value)) } } - impl DataBuilder<::planus::Initialized> { - /// Finish writing the builder to get an [UnionOffset](::planus::UnionOffset) to a serialized [Data]. + impl GetStatsResponseBuilder<(T0, T1)> { + /// Setter for the [`protocol` field](GetStatsResponse#structfield.protocol). #[inline] - pub fn finish(self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset + #[allow(clippy::type_complexity)] + pub fn protocol(self, value: T2) -> GetStatsResponseBuilder<(T0, T1, T2)> where - Self: ::planus::WriteAsUnion, + T2: ::planus::WriteAs<::planus::Offset>, { - ::planus::WriteAsUnion::prepare(&self, builder) + let (v0, v1) = self.0; + GetStatsResponseBuilder((v0, v1, value)) } } - impl ::planus::WriteAsUnion for DataBuilder<::planus::Initialized<1, T>> - where - T: ::planus::WriteAsOffset, - { + impl GetStatsResponseBuilder<(T0, T1, T2)> { + /// Setter for the [`messages_received` field](GetStatsResponse#structfield.messages_received). #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(1, (self.0).0.prepare(builder).downcast()) + #[allow(clippy::type_complexity)] + pub fn messages_received( + self, + value: T3, + ) -> GetStatsResponseBuilder<(T0, T1, T2, T3)> + where + T3: ::planus::WriteAsDefault, + { + let (v0, v1, v2) = self.0; + GetStatsResponseBuilder((v0, v1, v2, value)) + } + + /// Sets the [`messages_received` field](GetStatsResponse#structfield.messages_received) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn messages_received_as_default( + self, + ) -> GetStatsResponseBuilder<(T0, T1, T2, ::planus::DefaultValue)> { + self.messages_received(::planus::DefaultValue) } } - impl ::planus::WriteAsOptionalUnion for DataBuilder<::planus::Initialized<1, T>> - where - T: ::planus::WriteAsOffset, + impl GetStatsResponseBuilder<(T0, T1, T2, T3)> { + /// Setter for the [`bytes_received` field](GetStatsResponse#structfield.bytes_received). + #[inline] + #[allow(clippy::type_complexity)] + pub fn bytes_received( + self, + value: T4, + ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4)> + where + T4: ::planus::WriteAsDefault, + { + let (v0, v1, v2, v3) = self.0; + GetStatsResponseBuilder((v0, v1, v2, v3, value)) + } + + /// Sets the [`bytes_received` field](GetStatsResponse#structfield.bytes_received) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn bytes_received_as_default( + self, + ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, ::planus::DefaultValue)> + { + self.bytes_received(::planus::DefaultValue) + } + } + + impl GetStatsResponseBuilder<(T0, T1, T2, T3, T4)> { + /// Setter for the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount). + #[inline] + #[allow(clippy::type_complexity)] + pub fn buffered_amount( + self, + value: T5, + ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> + where + T5: ::planus::WriteAsDefault, + { + let (v0, v1, v2, v3, v4) = self.0; + GetStatsResponseBuilder((v0, v1, v2, v3, v4, value)) + } + + /// Sets the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount) to the default value. + #[inline] + #[allow(clippy::type_complexity)] + pub fn buffered_amount_as_default( + self, + ) -> GetStatsResponseBuilder<(T0, T1, T2, T3, T4, ::planus::DefaultValue)> + { + self.buffered_amount(::planus::DefaultValue) + } + } + + impl GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> { + /// Finish writing the builder to get an [Offset](::planus::Offset) to a serialized [GetStatsResponse]. + #[inline] + pub fn finish( + self, + builder: &mut ::planus::Builder, + ) -> ::planus::Offset + where + Self: ::planus::WriteAsOffset, + { + ::planus::WriteAsOffset::prepare(&self, builder) + } + } + + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset>, + T2: ::planus::WriteAs<::planus::Offset>, + T3: ::planus::WriteAsDefault, + T4: ::planus::WriteAsDefault, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAs<::planus::Offset> + for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> { + type Prepared = ::planus::Offset; + #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + ::planus::WriteAsOffset::prepare(self, builder) } } - impl ::planus::WriteAsUnion for DataBuilder<::planus::Initialized<2, T>> - where - T: ::planus::WriteAsOffset, + + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset>, + T2: ::planus::WriteAs<::planus::Offset>, + T3: ::planus::WriteAsDefault, + T4: ::planus::WriteAsDefault, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAsOptional<::planus::Offset> + for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> { + type Prepared = ::planus::Offset; + #[inline] - fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::UnionOffset { - ::planus::UnionOffset::new(2, (self.0).0.prepare(builder).downcast()) + fn prepare( + &self, + builder: &mut ::planus::Builder, + ) -> ::core::option::Option<::planus::Offset> { + ::core::option::Option::Some(::planus::WriteAsOffset::prepare(self, builder)) } } - impl ::planus::WriteAsOptionalUnion for DataBuilder<::planus::Initialized<2, T>> - where - T: ::planus::WriteAsOffset, + impl< + T0: ::planus::WriteAsDefault, + T1: ::planus::WriteAs<::planus::Offset>, + T2: ::planus::WriteAs<::planus::Offset>, + T3: ::planus::WriteAsDefault, + T4: ::planus::WriteAsDefault, + T5: ::planus::WriteAsDefault, + > ::planus::WriteAsOffset + for GetStatsResponseBuilder<(T0, T1, T2, T3, T4, T5)> { #[inline] fn prepare( &self, builder: &mut ::planus::Builder, - ) -> ::core::option::Option<::planus::UnionOffset> { - ::core::option::Option::Some(::planus::WriteAsUnion::prepare(self, builder)) + ) -> ::planus::Offset { + let (v0, v1, v2, v3, v4, v5) = &self.0; + GetStatsResponse::create(builder, v0, v1, v2, v3, v4, v5) } } - /// Reference to a deserialized [Data]. - #[derive(Copy, Clone, Debug)] - pub enum DataRef<'a> { - String(self::StringRef<'a>), - Binary(self::BinaryRef<'a>), + /// Reference to a deserialized [GetStatsResponse]. + #[derive(Copy, Clone)] + pub struct GetStatsResponseRef<'a>(::planus::table_reader::Table<'a>); + + impl<'a> GetStatsResponseRef<'a> { + /// Getter for the [`timestamp` field](GetStatsResponse#structfield.timestamp). + #[inline] + pub fn timestamp(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0 + .access(0, "GetStatsResponse", "timestamp")? + .unwrap_or(0), + ) + } + + /// Getter for the [`label` field](GetStatsResponse#structfield.label). + #[inline] + pub fn label(&self) -> ::planus::Result<&'a ::core::primitive::str> { + self.0.access_required(1, "GetStatsResponse", "label") + } + + /// Getter for the [`protocol` field](GetStatsResponse#structfield.protocol). + #[inline] + pub fn protocol(&self) -> ::planus::Result<&'a ::core::primitive::str> { + self.0.access_required(2, "GetStatsResponse", "protocol") + } + + /// Getter for the [`messages_received` field](GetStatsResponse#structfield.messages_received). + #[inline] + pub fn messages_received(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0 + .access(3, "GetStatsResponse", "messages_received")? + .unwrap_or(0), + ) + } + + /// Getter for the [`bytes_received` field](GetStatsResponse#structfield.bytes_received). + #[inline] + pub fn bytes_received(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0 + .access(4, "GetStatsResponse", "bytes_received")? + .unwrap_or(0), + ) + } + + /// Getter for the [`buffered_amount` field](GetStatsResponse#structfield.buffered_amount). + #[inline] + pub fn buffered_amount(&self) -> ::planus::Result { + ::core::result::Result::Ok( + self.0 + .access(5, "GetStatsResponse", "buffered_amount")? + .unwrap_or(0), + ) + } } - impl<'a> ::core::convert::TryFrom> for Data { - type Error = ::planus::Error; + impl<'a> ::core::fmt::Debug for GetStatsResponseRef<'a> { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + let mut f = f.debug_struct("GetStatsResponseRef"); + f.field("timestamp", &self.timestamp()); + f.field("label", &self.label()); + f.field("protocol", &self.protocol()); + f.field("messages_received", &self.messages_received()); + f.field("bytes_received", &self.bytes_received()); + f.field("buffered_amount", &self.buffered_amount()); + f.finish() + } + } - fn try_from(value: DataRef<'a>) -> ::planus::Result { - ::core::result::Result::Ok(match value { - DataRef::String(value) => Self::String(::planus::alloc::boxed::Box::new( - ::core::convert::TryFrom::try_from(value)?, - )), + impl<'a> ::core::convert::TryFrom> for GetStatsResponse { + type Error = ::planus::Error; - DataRef::Binary(value) => Self::Binary(::planus::alloc::boxed::Box::new( - ::core::convert::TryFrom::try_from(value)?, - )), + #[allow(unreachable_code)] + fn try_from(value: GetStatsResponseRef<'a>) -> ::planus::Result { + ::core::result::Result::Ok(Self { + timestamp: ::core::convert::TryInto::try_into(value.timestamp()?)?, + label: ::core::convert::TryInto::try_into(value.label()?)?, + protocol: ::core::convert::TryInto::try_into(value.protocol()?)?, + messages_received: ::core::convert::TryInto::try_into( + value.messages_received()?, + )?, + bytes_received: ::core::convert::TryInto::try_into( + value.bytes_received()?, + )?, + buffered_amount: ::core::convert::TryInto::try_into( + value.buffered_amount()?, + )?, }) } } - impl<'a> ::planus::TableReadUnion<'a> for DataRef<'a> { + impl<'a> ::planus::TableRead<'a> for GetStatsResponseRef<'a> { + #[inline] fn from_buffer( buffer: ::planus::SliceWithStartOffset<'a>, - field_offset: usize, - tag: u8, + offset: usize, ) -> ::core::result::Result { - match tag { - 1 => ::core::result::Result::Ok(Self::String( - ::planus::TableRead::from_buffer(buffer, field_offset)?, - )), - 2 => ::core::result::Result::Ok(Self::Binary( - ::planus::TableRead::from_buffer(buffer, field_offset)?, - )), - _ => ::core::result::Result::Err( - ::planus::errors::ErrorKind::UnknownUnionTag { tag }, - ), + ::core::result::Result::Ok(Self(::planus::table_reader::Table::from_buffer( + buffer, offset, + )?)) + } + } + + impl<'a> ::planus::VectorReadInner<'a> for GetStatsResponseRef<'a> { + type Error = ::planus::Error; + const STRIDE: usize = 4; + + unsafe fn from_buffer( + buffer: ::planus::SliceWithStartOffset<'a>, + offset: usize, + ) -> ::planus::Result { + ::planus::TableRead::from_buffer(buffer, offset).map_err(|error_kind| { + error_kind.with_error_location( + "[GetStatsResponseRef]", + "get", + buffer.offset_from_start, + ) + }) + } + } + + impl ::planus::VectorWrite<::planus::Offset> for GetStatsResponse { + type Value = ::planus::Offset; + const STRIDE: usize = 4; + #[inline] + fn prepare(&self, builder: &mut ::planus::Builder) -> Self::Value { + ::planus::WriteAs::prepare(self, builder) + } + + #[inline] + unsafe fn write_values( + values: &[::planus::Offset], + bytes: *mut ::core::mem::MaybeUninit, + buffer_position: u32, + ) { + let bytes = bytes as *mut [::core::mem::MaybeUninit; 4]; + for (i, v) in ::core::iter::Iterator::enumerate(values.iter()) { + ::planus::WriteAsPrimitive::write( + v, + ::planus::Cursor::new(&mut *bytes.add(i)), + buffer_position - (Self::STRIDE * i) as u32, + ); } } } + impl<'a> ::planus::ReadAsRoot<'a> for GetStatsResponseRef<'a> { + fn read_as_root(slice: &'a [u8]) -> ::planus::Result { + ::planus::TableRead::from_buffer( + ::planus::SliceWithStartOffset { + buffer: slice, + offset_from_start: 0, + }, + 0, + ) + .map_err(|error_kind| { + error_kind.with_error_location("[GetStatsResponseRef]", "read_as_root", 0) + }) + } + } + /// The table `SendNotification` in the namespace `FBS.DataProducer` /// /// Generated from these locations: - /// * Table `SendNotification` in the file `../worker/fbs/dataProducer.fbs:41` + /// * Table `SendNotification` in the file `../worker/fbs/dataProducer.fbs:28` #[derive( Clone, Debug, @@ -29345,7 +27993,7 @@ mod root { /// The field `ppid` in the table `SendNotification` pub ppid: u32, /// The field `data` in the table `SendNotification` - pub data: self::Data, + pub data: ::planus::alloc::vec::Vec, /// The field `subchannels` in the table `SendNotification` pub subchannels: ::core::option::Option<::planus::alloc::vec::Vec>, /// The field `required_subchannel` in the table `SendNotification` @@ -29363,7 +28011,7 @@ mod root { pub fn create( builder: &mut ::planus::Builder, field_ppid: impl ::planus::WriteAsDefault, - field_data: impl ::planus::WriteAsUnion, + field_data: impl ::planus::WriteAs<::planus::Offset<[u8]>>, field_subchannels: impl ::planus::WriteAsOptional<::planus::Offset<[u16]>>, field_required_subchannel: impl ::planus::WriteAsOptional, ) -> ::planus::Offset { @@ -29372,26 +28020,25 @@ mod root { let prepared_subchannels = field_subchannels.prepare(builder); let prepared_required_subchannel = field_required_subchannel.prepare(builder); - let mut table_writer: ::planus::table_writer::TableWriter<14> = + let mut table_writer: ::planus::table_writer::TableWriter<12> = ::core::default::Default::default(); if prepared_ppid.is_some() { table_writer.write_entry::(0); } - table_writer.write_entry::<::planus::Offset>(2); + table_writer.write_entry::<::planus::Offset<[u8]>>(1); if prepared_subchannels.is_some() { - table_writer.write_entry::<::planus::Offset<[u16]>>(3); + table_writer.write_entry::<::planus::Offset<[u16]>>(2); } if prepared_required_subchannel.is_some() { - table_writer.write_entry::(4); + table_writer.write_entry::(3); } - table_writer.write_entry::(1); unsafe { table_writer.finish(builder, |object_writer| { if let ::core::option::Option::Some(prepared_ppid) = prepared_ppid { object_writer.write::<_, _, 4>(&prepared_ppid); } - object_writer.write::<_, _, 4>(&prepared_data.offset()); + object_writer.write::<_, _, 4>(&prepared_data); if let ::core::option::Option::Some(prepared_subchannels) = prepared_subchannels { @@ -29402,7 +28049,6 @@ mod root { { object_writer.write::<_, _, 2>(&prepared_required_subchannel); } - object_writer.write::<_, _, 1>(&prepared_data.tag()); }); } builder.current_offset() @@ -29481,7 +28127,7 @@ mod root { #[allow(clippy::type_complexity)] pub fn data(self, value: T1) -> SendNotificationBuilder<(T0, T1)> where - T1: ::planus::WriteAsUnion, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, { let (v0,) = self.0; SendNotificationBuilder((v0, value)) @@ -29549,7 +28195,7 @@ mod root { impl< T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, T2: ::planus::WriteAsOptional<::planus::Offset<[u16]>>, T3: ::planus::WriteAsOptional, > ::planus::WriteAs<::planus::Offset> @@ -29568,7 +28214,7 @@ mod root { impl< T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, T2: ::planus::WriteAsOptional<::planus::Offset<[u16]>>, T3: ::planus::WriteAsOptional, > ::planus::WriteAsOptional<::planus::Offset> @@ -29587,7 +28233,7 @@ mod root { impl< T0: ::planus::WriteAsDefault, - T1: ::planus::WriteAsUnion, + T1: ::planus::WriteAs<::planus::Offset<[u8]>>, T2: ::planus::WriteAsOptional<::planus::Offset<[u16]>>, T3: ::planus::WriteAsOptional, > ::planus::WriteAsOffset @@ -29618,8 +28264,8 @@ mod root { /// Getter for the [`data` field](SendNotification#structfield.data). #[inline] - pub fn data(&self) -> ::planus::Result> { - self.0.access_union_required(1, "SendNotification", "data") + pub fn data(&self) -> ::planus::Result<&'a [u8]> { + self.0.access_required(1, "SendNotification", "data") } /// Getter for the [`subchannels` field](SendNotification#structfield.subchannels). @@ -29628,13 +28274,13 @@ mod root { &self, ) -> ::planus::Result<::core::option::Option<::planus::Vector<'a, u16>>> { - self.0.access(3, "SendNotification", "subchannels") + self.0.access(2, "SendNotification", "subchannels") } /// Getter for the [`required_subchannel` field](SendNotification#structfield.required_subchannel). #[inline] pub fn required_subchannel(&self) -> ::planus::Result<::core::option::Option> { - self.0.access(4, "SendNotification", "required_subchannel") + self.0.access(3, "SendNotification", "required_subchannel") } } @@ -29664,7 +28310,7 @@ mod root { fn try_from(value: SendNotificationRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { ppid: ::core::convert::TryInto::try_into(value.ppid()?)?, - data: ::core::convert::TryInto::try_into(value.data()?)?, + data: value.data()?.to_vec(), subchannels: if let ::core::option::Option::Some(subchannels) = value.subchannels()? { @@ -38792,7 +37438,7 @@ mod root { /// The enum `TraceEventType` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Enum `TraceEventType` in the file `../worker/fbs/transport.fbs:121` + /// * Enum `TraceEventType` in the file `../worker/fbs/transport.fbs:122` #[derive( Copy, Clone, @@ -38962,7 +37608,7 @@ mod root { /// The table `Dump` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `Dump` in the file `../worker/fbs/transport.fbs:126` + /// * Table `Dump` in the file `../worker/fbs/transport.fbs:127` #[derive( Clone, Debug, @@ -40005,7 +38651,7 @@ mod root { /// The table `Stats` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `Stats` in the file `../worker/fbs/transport.fbs:144` + /// * Table `Stats` in the file `../worker/fbs/transport.fbs:145` #[derive( Clone, Debug, PartialEq, PartialOrd, ::serde::Serialize, ::serde::Deserialize, )] @@ -42666,7 +41312,7 @@ mod root { /// The table `SetMaxIncomingBitrateRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `SetMaxIncomingBitrateRequest` in the file `../worker/fbs/transport.fbs:171` + /// * Table `SetMaxIncomingBitrateRequest` in the file `../worker/fbs/transport.fbs:172` #[derive( Clone, Debug, @@ -42974,7 +41620,7 @@ mod root { /// The table `SetMaxOutgoingBitrateRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `SetMaxOutgoingBitrateRequest` in the file `../worker/fbs/transport.fbs:175` + /// * Table `SetMaxOutgoingBitrateRequest` in the file `../worker/fbs/transport.fbs:176` #[derive( Clone, Debug, @@ -43282,7 +41928,7 @@ mod root { /// The table `SetMinOutgoingBitrateRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `SetMinOutgoingBitrateRequest` in the file `../worker/fbs/transport.fbs:179` + /// * Table `SetMinOutgoingBitrateRequest` in the file `../worker/fbs/transport.fbs:180` #[derive( Clone, Debug, @@ -43590,7 +42236,7 @@ mod root { /// The table `EnableTraceEventRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `EnableTraceEventRequest` in the file `../worker/fbs/transport.fbs:183` + /// * Table `EnableTraceEventRequest` in the file `../worker/fbs/transport.fbs:184` #[derive( Clone, Debug, @@ -43868,7 +42514,7 @@ mod root { /// The table `CloseProducerRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `CloseProducerRequest` in the file `../worker/fbs/transport.fbs:187` + /// * Table `CloseProducerRequest` in the file `../worker/fbs/transport.fbs:188` #[derive( Clone, Debug, @@ -44134,7 +42780,7 @@ mod root { /// The table `CloseConsumerRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `CloseConsumerRequest` in the file `../worker/fbs/transport.fbs:191` + /// * Table `CloseConsumerRequest` in the file `../worker/fbs/transport.fbs:192` #[derive( Clone, Debug, @@ -44400,7 +43046,7 @@ mod root { /// The table `CloseDataProducerRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `CloseDataProducerRequest` in the file `../worker/fbs/transport.fbs:195` + /// * Table `CloseDataProducerRequest` in the file `../worker/fbs/transport.fbs:196` #[derive( Clone, Debug, @@ -44675,7 +43321,7 @@ mod root { /// The table `CloseDataConsumerRequest` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `CloseDataConsumerRequest` in the file `../worker/fbs/transport.fbs:199` + /// * Table `CloseDataConsumerRequest` in the file `../worker/fbs/transport.fbs:200` #[derive( Clone, Debug, @@ -44950,7 +43596,7 @@ mod root { /// The table `SendRtcpNotification` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `SendRtcpNotification` in the file `../worker/fbs/transport.fbs:205` + /// * Table `SendRtcpNotification` in the file `../worker/fbs/transport.fbs:206` #[derive( Clone, Debug, @@ -45215,7 +43861,7 @@ mod root { /// The table `SctpStateChangeNotification` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `SctpStateChangeNotification` in the file `../worker/fbs/transport.fbs:211` + /// * Table `SctpStateChangeNotification` in the file `../worker/fbs/transport.fbs:212` #[derive( Clone, Debug, @@ -45536,7 +44182,7 @@ mod root { /// The union `TraceInfo` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Union `TraceInfo` in the file `../worker/fbs/transport.fbs:215` + /// * Union `TraceInfo` in the file `../worker/fbs/transport.fbs:216` #[derive( Clone, Debug, @@ -45689,7 +44335,7 @@ mod root { /// The enum `BweType` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Enum `BweType` in the file `../worker/fbs/transport.fbs:219` + /// * Enum `BweType` in the file `../worker/fbs/transport.fbs:220` #[derive( Copy, Clone, @@ -45859,7 +44505,7 @@ mod root { /// The table `BweTraceInfo` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `BweTraceInfo` in the file `../worker/fbs/transport.fbs:224` + /// * Table `BweTraceInfo` in the file `../worker/fbs/transport.fbs:225` #[derive( Clone, Debug, @@ -46537,7 +45183,7 @@ mod root { /// The table `TraceNotification` in the namespace `FBS.Transport` /// /// Generated from these locations: - /// * Table `TraceNotification` in the file `../worker/fbs/transport.fbs:235` + /// * Table `TraceNotification` in the file `../worker/fbs/transport.fbs:236` #[derive( Clone, Debug, @@ -64051,8 +62697,8 @@ mod root { ::serde::Deserialize, )] pub struct TupleHash { - /// The field `local_ice_username_fragment` in the table `TupleHash` - pub local_ice_username_fragment: u64, + /// The field `tuple_hash` in the table `TupleHash` + pub tuple_hash: u64, /// The field `web_rtc_transport_id` in the table `TupleHash` pub web_rtc_transport_id: ::planus::alloc::string::String, } @@ -64067,28 +62713,25 @@ mod root { #[allow(clippy::too_many_arguments)] pub fn create( builder: &mut ::planus::Builder, - field_local_ice_username_fragment: impl ::planus::WriteAsDefault, + field_tuple_hash: impl ::planus::WriteAsDefault, field_web_rtc_transport_id: impl ::planus::WriteAs<::planus::Offset>, ) -> ::planus::Offset { - let prepared_local_ice_username_fragment = - field_local_ice_username_fragment.prepare(builder, &0); + let prepared_tuple_hash = field_tuple_hash.prepare(builder, &0); let prepared_web_rtc_transport_id = field_web_rtc_transport_id.prepare(builder); let mut table_writer: ::planus::table_writer::TableWriter<8> = ::core::default::Default::default(); - if prepared_local_ice_username_fragment.is_some() { + if prepared_tuple_hash.is_some() { table_writer.write_entry::(0); } table_writer.write_entry::<::planus::Offset>(1); unsafe { table_writer.finish(builder, |object_writer| { - if let ::core::option::Option::Some( - prepared_local_ice_username_fragment, - ) = prepared_local_ice_username_fragment + if let ::core::option::Option::Some(prepared_tuple_hash) = + prepared_tuple_hash { - object_writer - .write::<_, _, 8>(&prepared_local_ice_username_fragment); + object_writer.write::<_, _, 8>(&prepared_tuple_hash); } object_writer.write::<_, _, 4>(&prepared_web_rtc_transport_id); }); @@ -64121,11 +62764,7 @@ mod root { impl ::planus::WriteAsOffset for TupleHash { #[inline] fn prepare(&self, builder: &mut ::planus::Builder) -> ::planus::Offset { - TupleHash::create( - builder, - self.local_ice_username_fragment, - &self.web_rtc_transport_id, - ) + TupleHash::create(builder, self.tuple_hash, &self.web_rtc_transport_id) } } @@ -64137,23 +62776,21 @@ mod root { pub struct TupleHashBuilder(State); impl TupleHashBuilder<()> { - /// Setter for the [`local_ice_username_fragment` field](TupleHash#structfield.local_ice_username_fragment). + /// Setter for the [`tuple_hash` field](TupleHash#structfield.tuple_hash). #[inline] #[allow(clippy::type_complexity)] - pub fn local_ice_username_fragment(self, value: T0) -> TupleHashBuilder<(T0,)> + pub fn tuple_hash(self, value: T0) -> TupleHashBuilder<(T0,)> where T0: ::planus::WriteAsDefault, { TupleHashBuilder((value,)) } - /// Sets the [`local_ice_username_fragment` field](TupleHash#structfield.local_ice_username_fragment) to the default value. + /// Sets the [`tuple_hash` field](TupleHash#structfield.tuple_hash) to the default value. #[inline] #[allow(clippy::type_complexity)] - pub fn local_ice_username_fragment_as_default( - self, - ) -> TupleHashBuilder<(::planus::DefaultValue,)> { - self.local_ice_username_fragment(::planus::DefaultValue) + pub fn tuple_hash_as_default(self) -> TupleHashBuilder<(::planus::DefaultValue,)> { + self.tuple_hash(::planus::DefaultValue) } } @@ -64228,13 +62865,11 @@ mod root { pub struct TupleHashRef<'a>(::planus::table_reader::Table<'a>); impl<'a> TupleHashRef<'a> { - /// Getter for the [`local_ice_username_fragment` field](TupleHash#structfield.local_ice_username_fragment). + /// Getter for the [`tuple_hash` field](TupleHash#structfield.tuple_hash). #[inline] - pub fn local_ice_username_fragment(&self) -> ::planus::Result { + pub fn tuple_hash(&self) -> ::planus::Result { ::core::result::Result::Ok( - self.0 - .access(0, "TupleHash", "local_ice_username_fragment")? - .unwrap_or(0), + self.0.access(0, "TupleHash", "tuple_hash")?.unwrap_or(0), ) } @@ -64249,10 +62884,7 @@ mod root { impl<'a> ::core::fmt::Debug for TupleHashRef<'a> { fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { let mut f = f.debug_struct("TupleHashRef"); - f.field( - "local_ice_username_fragment", - &self.local_ice_username_fragment(), - ); + f.field("tuple_hash", &self.tuple_hash()); f.field("web_rtc_transport_id", &self.web_rtc_transport_id()); f.finish() } @@ -64264,9 +62896,7 @@ mod root { #[allow(unreachable_code)] fn try_from(value: TupleHashRef<'a>) -> ::planus::Result { ::core::result::Result::Ok(Self { - local_ice_username_fragment: ::core::convert::TryInto::try_into( - value.local_ice_username_fragment()?, - )?, + tuple_hash: ::core::convert::TryInto::try_into(value.tuple_hash()?)?, web_rtc_transport_id: ::core::convert::TryInto::try_into( value.web_rtc_transport_id()?, )?, diff --git a/rust/src/messages.rs b/rust/src/messages.rs index 5e6f3b808f..a6c09b43df 100644 --- a/rust/src/messages.rs +++ b/rust/src/messages.rs @@ -365,7 +365,7 @@ impl Request for WebRtcServerDumpRequest { .tuple_hashes .into_iter() .map(|tuple_hash| WebRtcServerTupleHash { - tuple_hash: tuple_hash.local_ice_username_fragment, + tuple_hash: tuple_hash.tuple_hash, webrtc_transport_id: tuple_hash.web_rtc_transport_id.parse().unwrap(), }) .collect(), @@ -2878,12 +2878,10 @@ impl Notification for DataProducerSendNotification { fn into_bytes(self, handler_id: Self::HandlerId) -> Vec { let mut builder = Builder::new(); - let binary_data = data_producer::Binary::create(&mut builder, self.payload); - let binary = data_producer::Data::create_binary(&mut builder, binary_data); let data = data_producer::SendNotification::create( &mut builder, self.ppid, - binary, + self.payload, self.subchannels, self.required_subchannel, ); @@ -3179,9 +3177,7 @@ impl Request for DataConsumerSendRequest { fn into_bytes(self, id: u32, handler_id: Self::HandlerId) -> Vec { let mut builder = Builder::new(); - let binary_data = data_consumer::Binary::create(&mut builder, self.payload); - let binary = data_consumer::Data::create_binary(&mut builder, binary_data); - let data = data_consumer::SendRequest::create(&mut builder, self.ppid, binary); + let data = data_consumer::SendRequest::create(&mut builder, self.ppid, self.payload); let request_body = request::Body::create_data_consumer_send_request(&mut builder, data); let request = request::Request::create( diff --git a/worker/fbs/dataConsumer.fbs b/worker/fbs/dataConsumer.fbs index a458b2cdd3..2bebe33191 100644 --- a/worker/fbs/dataConsumer.fbs +++ b/worker/fbs/dataConsumer.fbs @@ -34,22 +34,9 @@ table GetStatsResponse { buffered_amount: uint32; } -table String { - value: string (required); -} - -table Binary { - value: [uint8] (required); -} - -union Data { - String, - Binary -} - table SendRequest { ppid: uint32; - data: Data (required); + data: [uint8] (required); } table SetSubchannelsRequest { diff --git a/worker/fbs/dataProducer.fbs b/worker/fbs/dataProducer.fbs index cd7657d7ec..3d8dbd367b 100644 --- a/worker/fbs/dataProducer.fbs +++ b/worker/fbs/dataProducer.fbs @@ -25,22 +25,9 @@ table GetStatsResponse { buffered_amount: uint32; } -table String { - value: string (required); -} - -table Binary { - value: [uint8] (required); -} - -union Data { - String, - Binary -} - table SendNotification { ppid: uint32; - data: Data (required); + data: [uint8] (required); subchannels: [uint16]; required_subchannel: uint16 = null; } diff --git a/worker/src/RTC/DataConsumer.cpp b/worker/src/RTC/DataConsumer.cpp index 26b18568fd..3f5fd69ffd 100644 --- a/worker/src/RTC/DataConsumer.cpp +++ b/worker/src/RTC/DataConsumer.cpp @@ -278,22 +278,9 @@ namespace RTC MS_THROW_ERROR("no SCTP association present"); } - const auto* body = request->data->body_as(); - const uint8_t* data{ nullptr }; - size_t len{ 0 }; - - if (body->data_type() == FBS::DataConsumer::Data::String) - { - data = body->data_as_String()->value()->Data(); - len = body->data_as_String()->value()->size(); - } - else - { - data = body->data_as_Binary()->value()->Data(); - len = body->data_as_Binary()->value()->size(); - } - - const int ppid = body->ppid(); + const auto* body = request->data->body_as(); + const uint8_t* data = body->data()->Data(); + size_t len = body->data()->size(); if (len > this->maxMessageSize) { @@ -318,7 +305,7 @@ namespace RTC static std::vector EmptySubchannels; - SendMessage(data, len, ppid, EmptySubchannels, std::nullopt, cb); + SendMessage(data, len, body->ppid(), EmptySubchannels, std::nullopt, cb); break; } diff --git a/worker/src/RTC/DataProducer.cpp b/worker/src/RTC/DataProducer.cpp index a55b58f6a9..34c9efc525 100644 --- a/worker/src/RTC/DataProducer.cpp +++ b/worker/src/RTC/DataProducer.cpp @@ -199,20 +199,9 @@ namespace RTC { case Channel::ChannelNotification::Event::DATAPRODUCER_SEND: { - const auto* body = notification->data->body_as(); - const uint8_t* data{ nullptr }; - size_t len{ 0 }; - - if (body->data_type() == FBS::DataProducer::Data::String) - { - data = body->data_as_String()->value()->Data(); - len = body->data_as_String()->value()->size(); - } - else - { - data = body->data_as_Binary()->value()->Data(); - len = body->data_as_Binary()->value()->size(); - } + const auto* body = notification->data->body_as(); + const uint8_t* data = body->data()->Data(); + size_t len = body->data()->size(); if (len > this->maxMessageSize) {