// automatically generated by the FlatBuffers compiler, do not modify // @generated use core::mem; use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod mmo { use core::mem; use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; #[allow(unused_imports, dead_code)] pub mod beacon { use core::mem; use core::cmp::Ordering; extern crate flatbuffers; use self::flatbuffers::{EndianScalar, Follow}; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MIN_VERB: i8 = 0; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MAX_VERB: i8 = 2; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[allow(non_camel_case_types)] pub const ENUM_VALUES_VERB: [Verb; 3] = [ Verb::Join, Verb::Leave, Verb::List, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[repr(transparent)] pub struct Verb(pub i8); #[allow(non_upper_case_globals)] impl Verb { pub const Join: Self = Self(0); pub const Leave: Self = Self(1); pub const List: Self = Self(2); pub const ENUM_MIN: i8 = 0; pub const ENUM_MAX: i8 = 2; pub const ENUM_VALUES: &'static [Self] = &[ Self::Join, Self::Leave, Self::List, ]; /// Returns the variant's name or "" if unknown. pub fn variant_name(self) -> Option<&'static str> { match self { Self::Join => Some("Join"), Self::Leave => Some("Leave"), Self::List => Some("List"), _ => None, } } } impl core::fmt::Debug for Verb { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { if let Some(name) = self.variant_name() { f.write_str(name) } else { f.write_fmt(format_args!("", self.0)) } } } impl<'a> flatbuffers::Follow<'a> for Verb { type Inner = Self; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { let b = flatbuffers::read_scalar_at::(buf, loc); Self(b) } } impl flatbuffers::Push for Verb { type Output = Verb; #[inline] unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { flatbuffers::emplace_scalar::(dst, self.0); } } impl flatbuffers::EndianScalar for Verb { type Scalar = i8; #[inline] fn to_little_endian(self) -> i8 { self.0.to_le() } #[inline] #[allow(clippy::wrong_self_convention)] fn from_little_endian(v: i8) -> Self { let b = i8::from_le(v); Self(b) } } impl<'a> flatbuffers::Verifiable for Verb { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; i8::run_verifier(v, pos) } } impl flatbuffers::SimpleToVerifyInSlice for Verb {} #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MIN_REQUEST: u8 = 0; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MAX_REQUEST: u8 = 3; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[allow(non_camel_case_types)] pub const ENUM_VALUES_REQUEST: [Request; 4] = [ Request::NONE, Request::JoinRequest, Request::LeaveRequest, Request::ListRequest, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[repr(transparent)] pub struct Request(pub u8); #[allow(non_upper_case_globals)] impl Request { pub const NONE: Self = Self(0); pub const JoinRequest: Self = Self(1); pub const LeaveRequest: Self = Self(2); pub const ListRequest: Self = Self(3); pub const ENUM_MIN: u8 = 0; pub const ENUM_MAX: u8 = 3; pub const ENUM_VALUES: &'static [Self] = &[ Self::NONE, Self::JoinRequest, Self::LeaveRequest, Self::ListRequest, ]; /// Returns the variant's name or "" if unknown. pub fn variant_name(self) -> Option<&'static str> { match self { Self::NONE => Some("NONE"), Self::JoinRequest => Some("JoinRequest"), Self::LeaveRequest => Some("LeaveRequest"), Self::ListRequest => Some("ListRequest"), _ => None, } } } impl core::fmt::Debug for Request { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { if let Some(name) = self.variant_name() { f.write_str(name) } else { f.write_fmt(format_args!("", self.0)) } } } impl<'a> flatbuffers::Follow<'a> for Request { type Inner = Self; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { let b = flatbuffers::read_scalar_at::(buf, loc); Self(b) } } impl flatbuffers::Push for Request { type Output = Request; #[inline] unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { flatbuffers::emplace_scalar::(dst, self.0); } } impl flatbuffers::EndianScalar for Request { type Scalar = u8; #[inline] fn to_little_endian(self) -> u8 { self.0.to_le() } #[inline] #[allow(clippy::wrong_self_convention)] fn from_little_endian(v: u8) -> Self { let b = u8::from_le(v); Self(b) } } impl<'a> flatbuffers::Verifiable for Request { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; u8::run_verifier(v, pos) } } impl flatbuffers::SimpleToVerifyInSlice for Request {} pub struct RequestUnionTableOffset {} #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MIN_RESPONSE: u8 = 0; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] pub const ENUM_MAX_RESPONSE: u8 = 3; #[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")] #[allow(non_camel_case_types)] pub const ENUM_VALUES_RESPONSE: [Response; 4] = [ Response::NONE, Response::JoinResponse, Response::LeaveResponse, Response::ListResponse, ]; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)] #[repr(transparent)] pub struct Response(pub u8); #[allow(non_upper_case_globals)] impl Response { pub const NONE: Self = Self(0); pub const JoinResponse: Self = Self(1); pub const LeaveResponse: Self = Self(2); pub const ListResponse: Self = Self(3); pub const ENUM_MIN: u8 = 0; pub const ENUM_MAX: u8 = 3; pub const ENUM_VALUES: &'static [Self] = &[ Self::NONE, Self::JoinResponse, Self::LeaveResponse, Self::ListResponse, ]; /// Returns the variant's name or "" if unknown. pub fn variant_name(self) -> Option<&'static str> { match self { Self::NONE => Some("NONE"), Self::JoinResponse => Some("JoinResponse"), Self::LeaveResponse => Some("LeaveResponse"), Self::ListResponse => Some("ListResponse"), _ => None, } } } impl core::fmt::Debug for Response { fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { if let Some(name) = self.variant_name() { f.write_str(name) } else { f.write_fmt(format_args!("", self.0)) } } } impl<'a> flatbuffers::Follow<'a> for Response { type Inner = Self; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { let b = flatbuffers::read_scalar_at::(buf, loc); Self(b) } } impl flatbuffers::Push for Response { type Output = Response; #[inline] unsafe fn push(&self, dst: &mut [u8], _written_len: usize) { flatbuffers::emplace_scalar::(dst, self.0); } } impl flatbuffers::EndianScalar for Response { type Scalar = u8; #[inline] fn to_little_endian(self) -> u8 { self.0.to_le() } #[inline] #[allow(clippy::wrong_self_convention)] fn from_little_endian(v: u8) -> Self { let b = u8::from_le(v); Self(b) } } impl<'a> flatbuffers::Verifiable for Response { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; u8::run_verifier(v, pos) } } impl flatbuffers::SimpleToVerifyInSlice for Response {} pub struct ResponseUnionTableOffset {} pub enum CallOffset {} #[derive(Copy, Clone, PartialEq)] pub struct Call<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for Call<'a> { type Inner = Call<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> Call<'a> { pub const VT_REQUEST_TYPE: flatbuffers::VOffsetT = 4; pub const VT_REQUEST: flatbuffers::VOffsetT = 6; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { Call { _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 CallArgs ) -> flatbuffers::WIPOffset> { let mut builder = CallBuilder::new(_fbb); if let Some(x) = args.request { builder.add_request(x); } builder.add_request_type(args.request_type); builder.finish() } #[inline] pub fn request_type(&self) -> Request { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::(Call::VT_REQUEST_TYPE, Some(Request::NONE)).unwrap()} } #[inline] pub fn request(&self) -> Option> { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>>(Call::VT_REQUEST, None)} } #[inline] #[allow(non_snake_case)] pub fn request_as_join_request(&self) -> Option> { if self.request_type() == Request::JoinRequest { self.request().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { JoinRequest::init_from_table(t) } }) } else { None } } #[inline] #[allow(non_snake_case)] pub fn request_as_leave_request(&self) -> Option> { if self.request_type() == Request::LeaveRequest { self.request().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { LeaveRequest::init_from_table(t) } }) } else { None } } #[inline] #[allow(non_snake_case)] pub fn request_as_list_request(&self) -> Option> { if self.request_type() == Request::ListRequest { self.request().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { ListRequest::init_from_table(t) } }) } else { None } } } impl flatbuffers::Verifiable for Call<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_union::("request_type", Self::VT_REQUEST_TYPE, "request", Self::VT_REQUEST, false, |key, v, pos| { match key { Request::JoinRequest => v.verify_union_variant::>("Request::JoinRequest", pos), Request::LeaveRequest => v.verify_union_variant::>("Request::LeaveRequest", pos), Request::ListRequest => v.verify_union_variant::>("Request::ListRequest", pos), _ => Ok(()), } })? .finish(); Ok(()) } } pub struct CallArgs { pub request_type: Request, pub request: Option>, } impl<'a> Default for CallArgs { #[inline] fn default() -> Self { CallArgs { request_type: Request::NONE, request: None, } } } pub struct CallBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CallBuilder<'a, 'b, A> { #[inline] pub fn add_request_type(&mut self, request_type: Request) { self.fbb_.push_slot::(Call::VT_REQUEST_TYPE, request_type, Request::NONE); } #[inline] pub fn add_request(&mut self, request: flatbuffers::WIPOffset) { self.fbb_.push_slot_always::>(Call::VT_REQUEST, request); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CallBuilder<'a, 'b, A> { let start = _fbb.start_table(); CallBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for Call<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("Call"); ds.field("request_type", &self.request_type()); match self.request_type() { Request::JoinRequest => { if let Some(x) = self.request_as_join_request() { ds.field("request", &x) } else { ds.field("request", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, Request::LeaveRequest => { if let Some(x) = self.request_as_leave_request() { ds.field("request", &x) } else { ds.field("request", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, Request::ListRequest => { if let Some(x) = self.request_as_list_request() { ds.field("request", &x) } else { ds.field("request", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, _ => { let x: Option<()> = None; ds.field("request", &x) }, }; ds.finish() } } pub enum JoinRequestOffset {} #[derive(Copy, Clone, PartialEq)] pub struct JoinRequest<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for JoinRequest<'a> { type Inner = JoinRequest<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> JoinRequest<'a> { pub const VT_UID: flatbuffers::VOffsetT = 4; pub const VT_CONTACT: flatbuffers::VOffsetT = 6; pub const VT_CLOCK: flatbuffers::VOffsetT = 8; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { JoinRequest { _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 JoinRequestArgs<'args> ) -> flatbuffers::WIPOffset> { let mut builder = JoinRequestBuilder::new(_fbb); builder.add_clock(args.clock); if let Some(x) = args.contact { builder.add_contact(x); } if let Some(x) = args.uid { builder.add_uid(x); } builder.finish() } #[inline] pub fn uid(&self) -> &'a str { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>(JoinRequest::VT_UID, None).unwrap()} } #[inline] pub fn contact(&self) -> &'a str { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>(JoinRequest::VT_CONTACT, None).unwrap()} } #[inline] pub fn clock(&self) -> i64 { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::(JoinRequest::VT_CLOCK, Some(0)).unwrap()} } } impl flatbuffers::Verifiable for JoinRequest<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_field::>("uid", Self::VT_UID, true)? .visit_field::>("contact", Self::VT_CONTACT, true)? .visit_field::("clock", Self::VT_CLOCK, false)? .finish(); Ok(()) } } pub struct JoinRequestArgs<'a> { pub uid: Option>, pub contact: Option>, pub clock: i64, } impl<'a> Default for JoinRequestArgs<'a> { #[inline] fn default() -> Self { JoinRequestArgs { uid: None, // required field contact: None, // required field clock: 0, } } } pub struct JoinRequestBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> JoinRequestBuilder<'a, 'b, A> { #[inline] pub fn add_uid(&mut self, uid: flatbuffers::WIPOffset<&'b str>) { self.fbb_.push_slot_always::>(JoinRequest::VT_UID, uid); } #[inline] pub fn add_contact(&mut self, contact: flatbuffers::WIPOffset<&'b str>) { self.fbb_.push_slot_always::>(JoinRequest::VT_CONTACT, contact); } #[inline] pub fn add_clock(&mut self, clock: i64) { self.fbb_.push_slot::(JoinRequest::VT_CLOCK, clock, 0); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> JoinRequestBuilder<'a, 'b, A> { let start = _fbb.start_table(); JoinRequestBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); self.fbb_.required(o, JoinRequest::VT_UID,"uid"); self.fbb_.required(o, JoinRequest::VT_CONTACT,"contact"); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for JoinRequest<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("JoinRequest"); ds.field("uid", &self.uid()); ds.field("contact", &self.contact()); ds.field("clock", &self.clock()); ds.finish() } } pub enum LeaveRequestOffset {} #[derive(Copy, Clone, PartialEq)] pub struct LeaveRequest<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for LeaveRequest<'a> { type Inner = LeaveRequest<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> LeaveRequest<'a> { pub const VT_UID: flatbuffers::VOffsetT = 4; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { LeaveRequest { _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 LeaveRequestArgs<'args> ) -> flatbuffers::WIPOffset> { let mut builder = LeaveRequestBuilder::new(_fbb); if let Some(x) = args.uid { builder.add_uid(x); } builder.finish() } #[inline] pub fn uid(&self) -> &'a str { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>(LeaveRequest::VT_UID, None).unwrap()} } } impl flatbuffers::Verifiable for LeaveRequest<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_field::>("uid", Self::VT_UID, true)? .finish(); Ok(()) } } pub struct LeaveRequestArgs<'a> { pub uid: Option>, } impl<'a> Default for LeaveRequestArgs<'a> { #[inline] fn default() -> Self { LeaveRequestArgs { uid: None, // required field } } } pub struct LeaveRequestBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LeaveRequestBuilder<'a, 'b, A> { #[inline] pub fn add_uid(&mut self, uid: flatbuffers::WIPOffset<&'b str>) { self.fbb_.push_slot_always::>(LeaveRequest::VT_UID, uid); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LeaveRequestBuilder<'a, 'b, A> { let start = _fbb.start_table(); LeaveRequestBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); self.fbb_.required(o, LeaveRequest::VT_UID,"uid"); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for LeaveRequest<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("LeaveRequest"); ds.field("uid", &self.uid()); ds.finish() } } pub enum ListRequestOffset {} #[derive(Copy, Clone, PartialEq)] pub struct ListRequest<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for ListRequest<'a> { type Inner = ListRequest<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> ListRequest<'a> { #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { ListRequest { _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 ListRequestArgs ) -> flatbuffers::WIPOffset> { let mut builder = ListRequestBuilder::new(_fbb); builder.finish() } } impl flatbuffers::Verifiable for ListRequest<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .finish(); Ok(()) } } pub struct ListRequestArgs { } impl<'a> Default for ListRequestArgs { #[inline] fn default() -> Self { ListRequestArgs { } } } pub struct ListRequestBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ListRequestBuilder<'a, 'b, A> { #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ListRequestBuilder<'a, 'b, A> { let start = _fbb.start_table(); ListRequestBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for ListRequest<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("ListRequest"); ds.finish() } } pub enum CallRespOffset {} #[derive(Copy, Clone, PartialEq)] pub struct CallResp<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for CallResp<'a> { type Inner = CallResp<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> CallResp<'a> { pub const VT_RESPONSE_TYPE: flatbuffers::VOffsetT = 4; pub const VT_RESPONSE: flatbuffers::VOffsetT = 6; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { CallResp { _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 CallRespArgs ) -> flatbuffers::WIPOffset> { let mut builder = CallRespBuilder::new(_fbb); if let Some(x) = args.response { builder.add_response(x); } builder.add_response_type(args.response_type); builder.finish() } #[inline] pub fn response_type(&self) -> Response { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::(CallResp::VT_RESPONSE_TYPE, Some(Response::NONE)).unwrap()} } #[inline] pub fn response(&self) -> Option> { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>>(CallResp::VT_RESPONSE, None)} } #[inline] #[allow(non_snake_case)] pub fn response_as_join_response(&self) -> Option> { if self.response_type() == Response::JoinResponse { self.response().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { JoinResponse::init_from_table(t) } }) } else { None } } #[inline] #[allow(non_snake_case)] pub fn response_as_leave_response(&self) -> Option> { if self.response_type() == Response::LeaveResponse { self.response().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { LeaveResponse::init_from_table(t) } }) } else { None } } #[inline] #[allow(non_snake_case)] pub fn response_as_list_response(&self) -> Option> { if self.response_type() == Response::ListResponse { self.response().map(|t| { // Safety: // Created from a valid Table for this object // Which contains a valid union in this slot unsafe { ListResponse::init_from_table(t) } }) } else { None } } } impl flatbuffers::Verifiable for CallResp<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_union::("response_type", Self::VT_RESPONSE_TYPE, "response", Self::VT_RESPONSE, false, |key, v, pos| { match key { Response::JoinResponse => v.verify_union_variant::>("Response::JoinResponse", pos), Response::LeaveResponse => v.verify_union_variant::>("Response::LeaveResponse", pos), Response::ListResponse => v.verify_union_variant::>("Response::ListResponse", pos), _ => Ok(()), } })? .finish(); Ok(()) } } pub struct CallRespArgs { pub response_type: Response, pub response: Option>, } impl<'a> Default for CallRespArgs { #[inline] fn default() -> Self { CallRespArgs { response_type: Response::NONE, response: None, } } } pub struct CallRespBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> CallRespBuilder<'a, 'b, A> { #[inline] pub fn add_response_type(&mut self, response_type: Response) { self.fbb_.push_slot::(CallResp::VT_RESPONSE_TYPE, response_type, Response::NONE); } #[inline] pub fn add_response(&mut self, response: flatbuffers::WIPOffset) { self.fbb_.push_slot_always::>(CallResp::VT_RESPONSE, response); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> CallRespBuilder<'a, 'b, A> { let start = _fbb.start_table(); CallRespBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for CallResp<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("CallResp"); ds.field("response_type", &self.response_type()); match self.response_type() { Response::JoinResponse => { if let Some(x) = self.response_as_join_response() { ds.field("response", &x) } else { ds.field("response", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, Response::LeaveResponse => { if let Some(x) = self.response_as_leave_response() { ds.field("response", &x) } else { ds.field("response", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, Response::ListResponse => { if let Some(x) = self.response_as_list_response() { ds.field("response", &x) } else { ds.field("response", &"InvalidFlatbuffer: Union discriminant does not match value.") } }, _ => { let x: Option<()> = None; ds.field("response", &x) }, }; ds.finish() } } pub enum JoinResponseOffset {} #[derive(Copy, Clone, PartialEq)] pub struct JoinResponse<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for JoinResponse<'a> { type Inner = JoinResponse<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> JoinResponse<'a> { #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { JoinResponse { _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 JoinResponseArgs ) -> flatbuffers::WIPOffset> { let mut builder = JoinResponseBuilder::new(_fbb); builder.finish() } } impl flatbuffers::Verifiable for JoinResponse<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .finish(); Ok(()) } } pub struct JoinResponseArgs { } impl<'a> Default for JoinResponseArgs { #[inline] fn default() -> Self { JoinResponseArgs { } } } pub struct JoinResponseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> JoinResponseBuilder<'a, 'b, A> { #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> JoinResponseBuilder<'a, 'b, A> { let start = _fbb.start_table(); JoinResponseBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for JoinResponse<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("JoinResponse"); ds.finish() } } pub enum LeaveResponseOffset {} #[derive(Copy, Clone, PartialEq)] pub struct LeaveResponse<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for LeaveResponse<'a> { type Inner = LeaveResponse<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> LeaveResponse<'a> { #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { LeaveResponse { _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 LeaveResponseArgs ) -> flatbuffers::WIPOffset> { let mut builder = LeaveResponseBuilder::new(_fbb); builder.finish() } } impl flatbuffers::Verifiable for LeaveResponse<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .finish(); Ok(()) } } pub struct LeaveResponseArgs { } impl<'a> Default for LeaveResponseArgs { #[inline] fn default() -> Self { LeaveResponseArgs { } } } pub struct LeaveResponseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> LeaveResponseBuilder<'a, 'b, A> { #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> LeaveResponseBuilder<'a, 'b, A> { let start = _fbb.start_table(); LeaveResponseBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for LeaveResponse<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("LeaveResponse"); ds.finish() } } pub enum ListResponseOffset {} #[derive(Copy, Clone, PartialEq)] pub struct ListResponse<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for ListResponse<'a> { type Inner = ListResponse<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> ListResponse<'a> { pub const VT_ENTITIES: flatbuffers::VOffsetT = 4; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { ListResponse { _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 ListResponseArgs<'args> ) -> flatbuffers::WIPOffset> { let mut builder = ListResponseBuilder::new(_fbb); if let Some(x) = args.entities { builder.add_entities(x); } builder.finish() } #[inline] pub fn entities(&self) -> Option>>> { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>>>(ListResponse::VT_ENTITIES, None)} } } impl flatbuffers::Verifiable for ListResponse<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_field::>>>("entities", Self::VT_ENTITIES, false)? .finish(); Ok(()) } } pub struct ListResponseArgs<'a> { pub entities: Option>>>>, } impl<'a> Default for ListResponseArgs<'a> { #[inline] fn default() -> Self { ListResponseArgs { entities: None, } } } pub struct ListResponseBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> ListResponseBuilder<'a, 'b, A> { #[inline] pub fn add_entities(&mut self, entities: flatbuffers::WIPOffset>>>) { self.fbb_.push_slot_always::>(ListResponse::VT_ENTITIES, entities); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> ListResponseBuilder<'a, 'b, A> { let start = _fbb.start_table(); ListResponseBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for ListResponse<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("ListResponse"); ds.field("entities", &self.entities()); ds.finish() } } pub enum EntityOffset {} #[derive(Copy, Clone, PartialEq)] pub struct Entity<'a> { pub _tab: flatbuffers::Table<'a>, } impl<'a> flatbuffers::Follow<'a> for Entity<'a> { type Inner = Entity<'a>; #[inline] unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { Self { _tab: flatbuffers::Table::new(buf, loc) } } } impl<'a> Entity<'a> { pub const VT_UID: flatbuffers::VOffsetT = 4; pub const VT_CLOCK: flatbuffers::VOffsetT = 6; #[inline] pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { Entity { _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 EntityArgs<'args> ) -> flatbuffers::WIPOffset> { let mut builder = EntityBuilder::new(_fbb); builder.add_clock(args.clock); if let Some(x) = args.uid { builder.add_uid(x); } builder.finish() } #[inline] pub fn uid(&self) -> &'a str { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::>(Entity::VT_UID, None).unwrap()} } #[inline] pub fn clock(&self) -> i64 { // Safety: // Created from valid Table for this object // which contains a valid value in this slot unsafe { self._tab.get::(Entity::VT_CLOCK, Some(0)).unwrap()} } } impl flatbuffers::Verifiable for Entity<'_> { #[inline] fn run_verifier( v: &mut flatbuffers::Verifier, pos: usize ) -> Result<(), flatbuffers::InvalidFlatbuffer> { use self::flatbuffers::Verifiable; v.visit_table(pos)? .visit_field::>("uid", Self::VT_UID, true)? .visit_field::("clock", Self::VT_CLOCK, false)? .finish(); Ok(()) } } pub struct EntityArgs<'a> { pub uid: Option>, pub clock: i64, } impl<'a> Default for EntityArgs<'a> { #[inline] fn default() -> Self { EntityArgs { uid: None, // required field clock: 0, } } } pub struct EntityBuilder<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> { fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a, A>, start_: flatbuffers::WIPOffset, } impl<'a: 'b, 'b, A: flatbuffers::Allocator + 'a> EntityBuilder<'a, 'b, A> { #[inline] pub fn add_uid(&mut self, uid: flatbuffers::WIPOffset<&'b str>) { self.fbb_.push_slot_always::>(Entity::VT_UID, uid); } #[inline] pub fn add_clock(&mut self, clock: i64) { self.fbb_.push_slot::(Entity::VT_CLOCK, clock, 0); } #[inline] pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a, A>) -> EntityBuilder<'a, 'b, A> { let start = _fbb.start_table(); EntityBuilder { fbb_: _fbb, start_: start, } } #[inline] pub fn finish(self) -> flatbuffers::WIPOffset> { let o = self.fbb_.end_table(self.start_); self.fbb_.required(o, Entity::VT_UID,"uid"); flatbuffers::WIPOffset::new(o.value()) } } impl core::fmt::Debug for Entity<'_> { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { let mut ds = f.debug_struct("Entity"); ds.field("uid", &self.uid()); ds.field("clock", &self.clock()); ds.finish() } } } // pub mod beacon } // pub mod mmo