* chore: Add copyright and license headers This commit adds the Apache 2.0 license and a copyright notice to the header of all source files. This ensures that the licensing and copyright information is clearly stated within the codebase. * cargo fmt * fix * fmt * fix clippy
139 lines
4.6 KiB
Rust
139 lines
4.6 KiB
Rust
// Copyright 2024 RustFS Team
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
// automatically generated by the FlatBuffers compiler, do not modify
|
|
|
|
// @generated
|
|
|
|
use core::cmp::Ordering;
|
|
use core::mem;
|
|
|
|
extern crate flatbuffers;
|
|
use self::flatbuffers::{EndianScalar, Follow};
|
|
|
|
#[allow(unused_imports, dead_code)]
|
|
pub mod models {
|
|
|
|
use core::cmp::Ordering;
|
|
use core::mem;
|
|
|
|
extern crate flatbuffers;
|
|
use self::flatbuffers::{EndianScalar, Follow};
|
|
|
|
pub enum PingBodyOffset {}
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
pub struct PingBody<'a> {
|
|
pub _tab: flatbuffers::Table<'a>,
|
|
}
|
|
|
|
impl<'a> flatbuffers::Follow<'a> for PingBody<'a> {
|
|
type Inner = PingBody<'a>;
|
|
#[inline]
|
|
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
|
|
Self {
|
|
_tab: unsafe { flatbuffers::Table::new(buf, loc) },
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<'a> PingBody<'a> {
|
|
pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4;
|
|
|
|
pub const fn get_fully_qualified_name() -> &'static str {
|
|
"models.PingBody"
|
|
}
|
|
|
|
#[inline]
|
|
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
|
|
PingBody { _tab: table }
|
|
}
|
|
#[allow(unused_mut)]
|
|
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
|
|
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
|
|
args: &'args PingBodyArgs<'args>,
|
|
) -> flatbuffers::WIPOffset<PingBody<'bldr>> {
|
|
let mut builder = PingBodyBuilder::new(_fbb);
|
|
if let Some(x) = args.payload {
|
|
builder.add_payload(x);
|
|
}
|
|
builder.finish()
|
|
}
|
|
|
|
#[inline]
|
|
pub fn payload(&self) -> Option<flatbuffers::Vector<'a, u8>> {
|
|
// Safety:
|
|
// Created from valid Table for this object
|
|
// which contains a valid value in this slot
|
|
unsafe {
|
|
self._tab
|
|
.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(PingBody::VT_PAYLOAD, None)
|
|
}
|
|
}
|
|
}
|
|
|
|
impl flatbuffers::Verifiable for PingBody<'_> {
|
|
#[inline]
|
|
fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> {
|
|
use self::flatbuffers::Verifiable;
|
|
v.visit_table(pos)?
|
|
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("payload", Self::VT_PAYLOAD, false)?
|
|
.finish();
|
|
Ok(())
|
|
}
|
|
}
|
|
pub struct PingBodyArgs<'a> {
|
|
pub payload: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
|
|
}
|
|
impl<'a> Default for PingBodyArgs<'a> {
|
|
#[inline]
|
|
fn default() -> Self {
|
|
PingBodyArgs { payload: None }
|
|
}
|
|
}
|
|
|
|
pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
|
|
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
|
|
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
|
|
}
|
|
impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> {
|
|
#[inline]
|
|
pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>) {
|
|
self.fbb_
|
|
.push_slot_always::<flatbuffers::WIPOffset<_>>(PingBody::VT_PAYLOAD, payload);
|
|
}
|
|
#[inline]
|
|
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> {
|
|
let start = _fbb.start_table();
|
|
PingBodyBuilder {
|
|
fbb_: _fbb,
|
|
start_: start,
|
|
}
|
|
}
|
|
#[inline]
|
|
pub fn finish(self) -> flatbuffers::WIPOffset<PingBody<'a>> {
|
|
let o = self.fbb_.end_table(self.start_);
|
|
flatbuffers::WIPOffset::new(o.value())
|
|
}
|
|
}
|
|
|
|
impl core::fmt::Debug for PingBody<'_> {
|
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
|
let mut ds = f.debug_struct("PingBody");
|
|
ds.field("payload", &self.payload());
|
|
ds.finish()
|
|
}
|
|
}
|
|
} // pub mod models
|