rustfs_protos/generated/flatbuffers_generated/
models.rs

1// Copyright 2024 RustFS Team
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// automatically generated by the FlatBuffers compiler, do not modify
16
17// @generated
18
19use core::cmp::Ordering;
20use core::mem;
21
22extern crate flatbuffers;
23use self::flatbuffers::{EndianScalar, Follow};
24
25#[allow(unused_imports, dead_code)]
26pub mod models {
27
28    use core::cmp::Ordering;
29    use core::mem;
30
31    extern crate flatbuffers;
32    use self::flatbuffers::{EndianScalar, Follow};
33
34    pub enum PingBodyOffset {}
35    #[derive(Copy, Clone, PartialEq)]
36
37    pub struct PingBody<'a> {
38        pub _tab: flatbuffers::Table<'a>,
39    }
40
41    impl<'a> flatbuffers::Follow<'a> for PingBody<'a> {
42        type Inner = PingBody<'a>;
43        #[inline]
44        unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
45            Self {
46                _tab: unsafe { flatbuffers::Table::new(buf, loc) },
47            }
48        }
49    }
50
51    impl<'a> PingBody<'a> {
52        pub const VT_PAYLOAD: flatbuffers::VOffsetT = 4;
53
54        pub const fn get_fully_qualified_name() -> &'static str {
55            "models.PingBody"
56        }
57
58        #[inline]
59        pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
60            PingBody { _tab: table }
61        }
62        #[allow(unused_mut)]
63        pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr, A: flatbuffers::Allocator + 'bldr>(
64            _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr, A>,
65            args: &'args PingBodyArgs<'args>,
66        ) -> flatbuffers::WIPOffset<PingBody<'bldr>> {
67            let mut builder = PingBodyBuilder::new(_fbb);
68            if let Some(x) = args.payload {
69                builder.add_payload(x);
70            }
71            builder.finish()
72        }
73
74        #[inline]
75        pub fn payload(&self) -> Option<flatbuffers::Vector<'a, u8>> {
76            // Safety:
77            // Created from valid Table for this object
78            // which contains a valid value in this slot
79            unsafe {
80                self._tab
81                    .get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, u8>>>(PingBody::VT_PAYLOAD, None)
82            }
83        }
84    }
85
86    impl flatbuffers::Verifiable for PingBody<'_> {
87        #[inline]
88        fn run_verifier(v: &mut flatbuffers::Verifier, pos: usize) -> Result<(), flatbuffers::InvalidFlatbuffer> {
89            use self::flatbuffers::Verifiable;
90            v.visit_table(pos)?
91                .visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, u8>>>("payload", Self::VT_PAYLOAD, false)?
92                .finish();
93            Ok(())
94        }
95    }
96    pub struct PingBodyArgs<'a> {
97        pub payload: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, u8>>>,
98    }
99    impl<'a> Default for PingBodyArgs<'a> {
100        #[inline]
101        fn default() -> Self {
102            PingBodyArgs { payload: None }
103        }
104    }
105
106    pub struct PingBodyBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> {
107        fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>,
108        start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
109    }
110    impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> PingBodyBuilder<'a, 'b, A> {
111        #[inline]
112        pub fn add_payload(&mut self, payload: flatbuffers::WIPOffset<flatbuffers::Vector<'b, u8>>) {
113            self.fbb_
114                .push_slot_always::<flatbuffers::WIPOffset<_>>(PingBody::VT_PAYLOAD, payload);
115        }
116        #[inline]
117        pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> PingBodyBuilder<'a, 'b, A> {
118            let start = _fbb.start_table();
119            PingBodyBuilder {
120                fbb_: _fbb,
121                start_: start,
122            }
123        }
124        #[inline]
125        pub fn finish(self) -> flatbuffers::WIPOffset<PingBody<'a>> {
126            let o = self.fbb_.end_table(self.start_);
127            flatbuffers::WIPOffset::new(o.value())
128        }
129    }
130
131    impl core::fmt::Debug for PingBody<'_> {
132        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
133            let mut ds = f.debug_struct("PingBody");
134            ds.field("payload", &self.payload());
135            ds.finish()
136        }
137    }
138} // pub mod models