ndb_profile.rs (22296B)
1 // automatically generated by the FlatBuffers compiler, do not modify 2 3 // @generated 4 5 use core::cmp::Ordering; 6 use core::mem; 7 8 extern crate flatbuffers; 9 use self::flatbuffers::{EndianScalar, Follow}; 10 11 pub enum NdbProfileOffset {} 12 #[derive(Copy, Clone, PartialEq)] 13 14 pub struct NdbProfile<'a> { 15 pub _tab: flatbuffers::Table<'a>, 16 } 17 18 impl<'a> flatbuffers::Follow<'a> for NdbProfile<'a> { 19 type Inner = NdbProfile<'a>; 20 #[inline] 21 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { 22 Self { 23 _tab: flatbuffers::Table::new(buf, loc), 24 } 25 } 26 } 27 28 impl<'a> NdbProfile<'a> { 29 pub const VT_NAME: flatbuffers::VOffsetT = 4; 30 pub const VT_WEBSITE: flatbuffers::VOffsetT = 6; 31 pub const VT_ABOUT: flatbuffers::VOffsetT = 8; 32 pub const VT_LUD16: flatbuffers::VOffsetT = 10; 33 pub const VT_BANNER: flatbuffers::VOffsetT = 12; 34 pub const VT_DISPLAY_NAME: flatbuffers::VOffsetT = 14; 35 pub const VT_REACTIONS: flatbuffers::VOffsetT = 16; 36 pub const VT_PICTURE: flatbuffers::VOffsetT = 18; 37 pub const VT_NIP05: flatbuffers::VOffsetT = 20; 38 pub const VT_DAMUS_DONATION: flatbuffers::VOffsetT = 22; 39 pub const VT_DAMUS_DONATION_V2: flatbuffers::VOffsetT = 24; 40 pub const VT_LUD06: flatbuffers::VOffsetT = 26; 41 42 #[inline] 43 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { 44 NdbProfile { _tab: table } 45 } 46 #[allow(unused_mut)] 47 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( 48 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, 49 args: &'args NdbProfileArgs<'args>, 50 ) -> flatbuffers::WIPOffset<NdbProfile<'bldr>> { 51 let mut builder = NdbProfileBuilder::new(_fbb); 52 if let Some(x) = args.lud06 { 53 builder.add_lud06(x); 54 } 55 builder.add_damus_donation_v2(args.damus_donation_v2); 56 builder.add_damus_donation(args.damus_donation); 57 if let Some(x) = args.nip05 { 58 builder.add_nip05(x); 59 } 60 if let Some(x) = args.picture { 61 builder.add_picture(x); 62 } 63 if let Some(x) = args.display_name { 64 builder.add_display_name(x); 65 } 66 if let Some(x) = args.banner { 67 builder.add_banner(x); 68 } 69 if let Some(x) = args.lud16 { 70 builder.add_lud16(x); 71 } 72 if let Some(x) = args.about { 73 builder.add_about(x); 74 } 75 if let Some(x) = args.website { 76 builder.add_website(x); 77 } 78 if let Some(x) = args.name { 79 builder.add_name(x); 80 } 81 builder.add_reactions(args.reactions); 82 builder.finish() 83 } 84 85 #[inline] 86 pub fn name(&self) -> Option<&'a str> { 87 // Safety: 88 // Created from valid Table for this object 89 // which contains a valid value in this slot 90 unsafe { 91 self._tab 92 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_NAME, None) 93 } 94 } 95 #[inline] 96 pub fn website(&self) -> Option<&'a str> { 97 // Safety: 98 // Created from valid Table for this object 99 // which contains a valid value in this slot 100 unsafe { 101 self._tab 102 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_WEBSITE, None) 103 } 104 } 105 #[inline] 106 pub fn about(&self) -> Option<&'a str> { 107 // Safety: 108 // Created from valid Table for this object 109 // which contains a valid value in this slot 110 unsafe { 111 self._tab 112 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_ABOUT, None) 113 } 114 } 115 #[inline] 116 pub fn lud16(&self) -> Option<&'a str> { 117 // Safety: 118 // Created from valid Table for this object 119 // which contains a valid value in this slot 120 unsafe { 121 self._tab 122 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_LUD16, None) 123 } 124 } 125 #[inline] 126 pub fn banner(&self) -> Option<&'a str> { 127 // Safety: 128 // Created from valid Table for this object 129 // which contains a valid value in this slot 130 unsafe { 131 self._tab 132 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_BANNER, None) 133 } 134 } 135 #[inline] 136 pub fn display_name(&self) -> Option<&'a str> { 137 // Safety: 138 // Created from valid Table for this object 139 // which contains a valid value in this slot 140 unsafe { 141 self._tab 142 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_DISPLAY_NAME, None) 143 } 144 } 145 #[inline] 146 pub fn reactions(&self) -> bool { 147 // Safety: 148 // Created from valid Table for this object 149 // which contains a valid value in this slot 150 unsafe { 151 self._tab 152 .get::<bool>(NdbProfile::VT_REACTIONS, Some(true)) 153 .unwrap() 154 } 155 } 156 #[inline] 157 pub fn picture(&self) -> Option<&'a str> { 158 // Safety: 159 // Created from valid Table for this object 160 // which contains a valid value in this slot 161 unsafe { 162 self._tab 163 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_PICTURE, None) 164 } 165 } 166 #[inline] 167 pub fn nip05(&self) -> Option<&'a str> { 168 // Safety: 169 // Created from valid Table for this object 170 // which contains a valid value in this slot 171 unsafe { 172 self._tab 173 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_NIP05, None) 174 } 175 } 176 #[inline] 177 pub fn damus_donation(&self) -> i32 { 178 // Safety: 179 // Created from valid Table for this object 180 // which contains a valid value in this slot 181 unsafe { 182 self._tab 183 .get::<i32>(NdbProfile::VT_DAMUS_DONATION, Some(0)) 184 .unwrap() 185 } 186 } 187 #[inline] 188 pub fn damus_donation_v2(&self) -> i32 { 189 // Safety: 190 // Created from valid Table for this object 191 // which contains a valid value in this slot 192 unsafe { 193 self._tab 194 .get::<i32>(NdbProfile::VT_DAMUS_DONATION_V2, Some(0)) 195 .unwrap() 196 } 197 } 198 #[inline] 199 pub fn lud06(&self) -> Option<&'a str> { 200 // Safety: 201 // Created from valid Table for this object 202 // which contains a valid value in this slot 203 unsafe { 204 self._tab 205 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfile::VT_LUD06, None) 206 } 207 } 208 } 209 210 impl flatbuffers::Verifiable for NdbProfile<'_> { 211 #[inline] 212 fn run_verifier( 213 v: &mut flatbuffers::Verifier, 214 pos: usize, 215 ) -> Result<(), flatbuffers::InvalidFlatbuffer> { 216 use self::flatbuffers::Verifiable; 217 v.visit_table(pos)? 218 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)? 219 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("website", Self::VT_WEBSITE, false)? 220 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("about", Self::VT_ABOUT, false)? 221 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("lud16", Self::VT_LUD16, false)? 222 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("banner", Self::VT_BANNER, false)? 223 .visit_field::<flatbuffers::ForwardsUOffset<&str>>( 224 "display_name", 225 Self::VT_DISPLAY_NAME, 226 false, 227 )? 228 .visit_field::<bool>("reactions", Self::VT_REACTIONS, false)? 229 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("picture", Self::VT_PICTURE, false)? 230 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("nip05", Self::VT_NIP05, false)? 231 .visit_field::<i32>("damus_donation", Self::VT_DAMUS_DONATION, false)? 232 .visit_field::<i32>("damus_donation_v2", Self::VT_DAMUS_DONATION_V2, false)? 233 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("lud06", Self::VT_LUD06, false)? 234 .finish(); 235 Ok(()) 236 } 237 } 238 pub struct NdbProfileArgs<'a> { 239 pub name: Option<flatbuffers::WIPOffset<&'a str>>, 240 pub website: Option<flatbuffers::WIPOffset<&'a str>>, 241 pub about: Option<flatbuffers::WIPOffset<&'a str>>, 242 pub lud16: Option<flatbuffers::WIPOffset<&'a str>>, 243 pub banner: Option<flatbuffers::WIPOffset<&'a str>>, 244 pub display_name: Option<flatbuffers::WIPOffset<&'a str>>, 245 pub reactions: bool, 246 pub picture: Option<flatbuffers::WIPOffset<&'a str>>, 247 pub nip05: Option<flatbuffers::WIPOffset<&'a str>>, 248 pub damus_donation: i32, 249 pub damus_donation_v2: i32, 250 pub lud06: Option<flatbuffers::WIPOffset<&'a str>>, 251 } 252 impl<'a> Default for NdbProfileArgs<'a> { 253 #[inline] 254 fn default() -> Self { 255 NdbProfileArgs { 256 name: None, 257 website: None, 258 about: None, 259 lud16: None, 260 banner: None, 261 display_name: None, 262 reactions: true, 263 picture: None, 264 nip05: None, 265 damus_donation: 0, 266 damus_donation_v2: 0, 267 lud06: None, 268 } 269 } 270 } 271 272 pub struct NdbProfileBuilder<'a: 'b, 'b> { 273 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, 274 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, 275 } 276 impl<'a: 'b, 'b> NdbProfileBuilder<'a, 'b> { 277 #[inline] 278 pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) { 279 self.fbb_ 280 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_NAME, name); 281 } 282 #[inline] 283 pub fn add_website(&mut self, website: flatbuffers::WIPOffset<&'b str>) { 284 self.fbb_ 285 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_WEBSITE, website); 286 } 287 #[inline] 288 pub fn add_about(&mut self, about: flatbuffers::WIPOffset<&'b str>) { 289 self.fbb_ 290 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_ABOUT, about); 291 } 292 #[inline] 293 pub fn add_lud16(&mut self, lud16: flatbuffers::WIPOffset<&'b str>) { 294 self.fbb_ 295 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_LUD16, lud16); 296 } 297 #[inline] 298 pub fn add_banner(&mut self, banner: flatbuffers::WIPOffset<&'b str>) { 299 self.fbb_ 300 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_BANNER, banner); 301 } 302 #[inline] 303 pub fn add_display_name(&mut self, display_name: flatbuffers::WIPOffset<&'b str>) { 304 self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>( 305 NdbProfile::VT_DISPLAY_NAME, 306 display_name, 307 ); 308 } 309 #[inline] 310 pub fn add_reactions(&mut self, reactions: bool) { 311 self.fbb_ 312 .push_slot::<bool>(NdbProfile::VT_REACTIONS, reactions, true); 313 } 314 #[inline] 315 pub fn add_picture(&mut self, picture: flatbuffers::WIPOffset<&'b str>) { 316 self.fbb_ 317 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_PICTURE, picture); 318 } 319 #[inline] 320 pub fn add_nip05(&mut self, nip05: flatbuffers::WIPOffset<&'b str>) { 321 self.fbb_ 322 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_NIP05, nip05); 323 } 324 #[inline] 325 pub fn add_damus_donation(&mut self, damus_donation: i32) { 326 self.fbb_ 327 .push_slot::<i32>(NdbProfile::VT_DAMUS_DONATION, damus_donation, 0); 328 } 329 #[inline] 330 pub fn add_damus_donation_v2(&mut self, damus_donation_v2: i32) { 331 self.fbb_ 332 .push_slot::<i32>(NdbProfile::VT_DAMUS_DONATION_V2, damus_donation_v2, 0); 333 } 334 #[inline] 335 pub fn add_lud06(&mut self, lud06: flatbuffers::WIPOffset<&'b str>) { 336 self.fbb_ 337 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfile::VT_LUD06, lud06); 338 } 339 #[inline] 340 pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> NdbProfileBuilder<'a, 'b> { 341 let start = _fbb.start_table(); 342 NdbProfileBuilder { 343 fbb_: _fbb, 344 start_: start, 345 } 346 } 347 #[inline] 348 pub fn finish(self) -> flatbuffers::WIPOffset<NdbProfile<'a>> { 349 let o = self.fbb_.end_table(self.start_); 350 flatbuffers::WIPOffset::new(o.value()) 351 } 352 } 353 354 impl core::fmt::Debug for NdbProfile<'_> { 355 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 356 let mut ds = f.debug_struct("NdbProfile"); 357 ds.field("name", &self.name()); 358 ds.field("website", &self.website()); 359 ds.field("about", &self.about()); 360 ds.field("lud16", &self.lud16()); 361 ds.field("banner", &self.banner()); 362 ds.field("display_name", &self.display_name()); 363 ds.field("reactions", &self.reactions()); 364 ds.field("picture", &self.picture()); 365 ds.field("nip05", &self.nip05()); 366 ds.field("damus_donation", &self.damus_donation()); 367 ds.field("damus_donation_v2", &self.damus_donation_v2()); 368 ds.field("lud06", &self.lud06()); 369 ds.finish() 370 } 371 } 372 pub enum NdbProfileRecordOffset {} 373 #[derive(Copy, Clone, PartialEq)] 374 375 pub struct NdbProfileRecord<'a> { 376 pub _tab: flatbuffers::Table<'a>, 377 } 378 379 impl<'a> flatbuffers::Follow<'a> for NdbProfileRecord<'a> { 380 type Inner = NdbProfileRecord<'a>; 381 #[inline] 382 unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner { 383 Self { 384 _tab: flatbuffers::Table::new(buf, loc), 385 } 386 } 387 } 388 389 impl<'a> NdbProfileRecord<'a> { 390 pub const VT_PROFILE: flatbuffers::VOffsetT = 4; 391 pub const VT_RECEIVED_AT: flatbuffers::VOffsetT = 6; 392 pub const VT_NOTE_KEY: flatbuffers::VOffsetT = 8; 393 pub const VT_LNURL: flatbuffers::VOffsetT = 10; 394 395 #[inline] 396 pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self { 397 NdbProfileRecord { _tab: table } 398 } 399 #[allow(unused_mut)] 400 pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>( 401 _fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>, 402 args: &'args NdbProfileRecordArgs<'args>, 403 ) -> flatbuffers::WIPOffset<NdbProfileRecord<'bldr>> { 404 let mut builder = NdbProfileRecordBuilder::new(_fbb); 405 builder.add_note_key(args.note_key); 406 builder.add_received_at(args.received_at); 407 if let Some(x) = args.lnurl { 408 builder.add_lnurl(x); 409 } 410 if let Some(x) = args.profile { 411 builder.add_profile(x); 412 } 413 builder.finish() 414 } 415 416 #[inline] 417 pub fn profile(&self) -> Option<NdbProfile<'a>> { 418 // Safety: 419 // Created from valid Table for this object 420 // which contains a valid value in this slot 421 unsafe { 422 self._tab 423 .get::<flatbuffers::ForwardsUOffset<NdbProfile>>(NdbProfileRecord::VT_PROFILE, None) 424 } 425 } 426 #[inline] 427 pub fn received_at(&self) -> u64 { 428 // Safety: 429 // Created from valid Table for this object 430 // which contains a valid value in this slot 431 unsafe { 432 self._tab 433 .get::<u64>(NdbProfileRecord::VT_RECEIVED_AT, Some(0)) 434 .unwrap() 435 } 436 } 437 #[inline] 438 pub fn note_key(&self) -> u64 { 439 // Safety: 440 // Created from valid Table for this object 441 // which contains a valid value in this slot 442 unsafe { 443 self._tab 444 .get::<u64>(NdbProfileRecord::VT_NOTE_KEY, Some(0)) 445 .unwrap() 446 } 447 } 448 #[inline] 449 pub fn lnurl(&self) -> Option<&'a str> { 450 // Safety: 451 // Created from valid Table for this object 452 // which contains a valid value in this slot 453 unsafe { 454 self._tab 455 .get::<flatbuffers::ForwardsUOffset<&str>>(NdbProfileRecord::VT_LNURL, None) 456 } 457 } 458 } 459 460 impl flatbuffers::Verifiable for NdbProfileRecord<'_> { 461 #[inline] 462 fn run_verifier( 463 v: &mut flatbuffers::Verifier, 464 pos: usize, 465 ) -> Result<(), flatbuffers::InvalidFlatbuffer> { 466 use self::flatbuffers::Verifiable; 467 v.visit_table(pos)? 468 .visit_field::<flatbuffers::ForwardsUOffset<NdbProfile>>( 469 "profile", 470 Self::VT_PROFILE, 471 false, 472 )? 473 .visit_field::<u64>("received_at", Self::VT_RECEIVED_AT, false)? 474 .visit_field::<u64>("note_key", Self::VT_NOTE_KEY, false)? 475 .visit_field::<flatbuffers::ForwardsUOffset<&str>>("lnurl", Self::VT_LNURL, false)? 476 .finish(); 477 Ok(()) 478 } 479 } 480 pub struct NdbProfileRecordArgs<'a> { 481 pub profile: Option<flatbuffers::WIPOffset<NdbProfile<'a>>>, 482 pub received_at: u64, 483 pub note_key: u64, 484 pub lnurl: Option<flatbuffers::WIPOffset<&'a str>>, 485 } 486 impl<'a> Default for NdbProfileRecordArgs<'a> { 487 #[inline] 488 fn default() -> Self { 489 NdbProfileRecordArgs { 490 profile: None, 491 received_at: 0, 492 note_key: 0, 493 lnurl: None, 494 } 495 } 496 } 497 498 pub struct NdbProfileRecordBuilder<'a: 'b, 'b> { 499 fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>, 500 start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>, 501 } 502 impl<'a: 'b, 'b> NdbProfileRecordBuilder<'a, 'b> { 503 #[inline] 504 pub fn add_profile(&mut self, profile: flatbuffers::WIPOffset<NdbProfile<'b>>) { 505 self.fbb_ 506 .push_slot_always::<flatbuffers::WIPOffset<NdbProfile>>( 507 NdbProfileRecord::VT_PROFILE, 508 profile, 509 ); 510 } 511 #[inline] 512 pub fn add_received_at(&mut self, received_at: u64) { 513 self.fbb_ 514 .push_slot::<u64>(NdbProfileRecord::VT_RECEIVED_AT, received_at, 0); 515 } 516 #[inline] 517 pub fn add_note_key(&mut self, note_key: u64) { 518 self.fbb_ 519 .push_slot::<u64>(NdbProfileRecord::VT_NOTE_KEY, note_key, 0); 520 } 521 #[inline] 522 pub fn add_lnurl(&mut self, lnurl: flatbuffers::WIPOffset<&'b str>) { 523 self.fbb_ 524 .push_slot_always::<flatbuffers::WIPOffset<_>>(NdbProfileRecord::VT_LNURL, lnurl); 525 } 526 #[inline] 527 pub fn new( 528 _fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, 529 ) -> NdbProfileRecordBuilder<'a, 'b> { 530 let start = _fbb.start_table(); 531 NdbProfileRecordBuilder { 532 fbb_: _fbb, 533 start_: start, 534 } 535 } 536 #[inline] 537 pub fn finish(self) -> flatbuffers::WIPOffset<NdbProfileRecord<'a>> { 538 let o = self.fbb_.end_table(self.start_); 539 flatbuffers::WIPOffset::new(o.value()) 540 } 541 } 542 543 impl core::fmt::Debug for NdbProfileRecord<'_> { 544 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { 545 let mut ds = f.debug_struct("NdbProfileRecord"); 546 ds.field("profile", &self.profile()); 547 ds.field("received_at", &self.received_at()); 548 ds.field("note_key", &self.note_key()); 549 ds.field("lnurl", &self.lnurl()); 550 ds.finish() 551 } 552 } 553 #[inline] 554 /// Verifies that a buffer of bytes contains a `NdbProfileRecord` 555 /// and returns it. 556 /// Note that verification is still experimental and may not 557 /// catch every error, or be maximally performant. For the 558 /// previous, unchecked, behavior use 559 /// `root_as_ndb_profile_record_unchecked`. 560 pub fn root_as_ndb_profile_record( 561 buf: &[u8], 562 ) -> Result<NdbProfileRecord, flatbuffers::InvalidFlatbuffer> { 563 flatbuffers::root::<NdbProfileRecord>(buf) 564 } 565 #[inline] 566 /// Verifies that a buffer of bytes contains a size prefixed 567 /// `NdbProfileRecord` and returns it. 568 /// Note that verification is still experimental and may not 569 /// catch every error, or be maximally performant. For the 570 /// previous, unchecked, behavior use 571 /// `size_prefixed_root_as_ndb_profile_record_unchecked`. 572 pub fn size_prefixed_root_as_ndb_profile_record( 573 buf: &[u8], 574 ) -> Result<NdbProfileRecord, flatbuffers::InvalidFlatbuffer> { 575 flatbuffers::size_prefixed_root::<NdbProfileRecord>(buf) 576 } 577 #[inline] 578 /// Verifies, with the given options, that a buffer of bytes 579 /// contains a `NdbProfileRecord` and returns it. 580 /// Note that verification is still experimental and may not 581 /// catch every error, or be maximally performant. For the 582 /// previous, unchecked, behavior use 583 /// `root_as_ndb_profile_record_unchecked`. 584 pub fn root_as_ndb_profile_record_with_opts<'b, 'o>( 585 opts: &'o flatbuffers::VerifierOptions, 586 buf: &'b [u8], 587 ) -> Result<NdbProfileRecord<'b>, flatbuffers::InvalidFlatbuffer> { 588 flatbuffers::root_with_opts::<NdbProfileRecord<'b>>(opts, buf) 589 } 590 #[inline] 591 /// Verifies, with the given verifier options, that a buffer of 592 /// bytes contains a size prefixed `NdbProfileRecord` and returns 593 /// it. Note that verification is still experimental and may not 594 /// catch every error, or be maximally performant. For the 595 /// previous, unchecked, behavior use 596 /// `root_as_ndb_profile_record_unchecked`. 597 pub fn size_prefixed_root_as_ndb_profile_record_with_opts<'b, 'o>( 598 opts: &'o flatbuffers::VerifierOptions, 599 buf: &'b [u8], 600 ) -> Result<NdbProfileRecord<'b>, flatbuffers::InvalidFlatbuffer> { 601 flatbuffers::size_prefixed_root_with_opts::<NdbProfileRecord<'b>>(opts, buf) 602 } 603 #[inline] 604 /// Assumes, without verification, that a buffer of bytes contains a NdbProfileRecord and returns it. 605 /// # Safety 606 /// Callers must trust the given bytes do indeed contain a valid `NdbProfileRecord`. 607 pub unsafe fn root_as_ndb_profile_record_unchecked(buf: &[u8]) -> NdbProfileRecord { 608 flatbuffers::root_unchecked::<NdbProfileRecord>(buf) 609 } 610 #[inline] 611 /// Assumes, without verification, that a buffer of bytes contains a size prefixed NdbProfileRecord and returns it. 612 /// # Safety 613 /// Callers must trust the given bytes do indeed contain a valid size prefixed `NdbProfileRecord`. 614 pub unsafe fn size_prefixed_root_as_ndb_profile_record_unchecked(buf: &[u8]) -> NdbProfileRecord { 615 flatbuffers::size_prefixed_root_unchecked::<NdbProfileRecord>(buf) 616 } 617 #[inline] 618 pub fn finish_ndb_profile_record_buffer<'a, 'b>( 619 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, 620 root: flatbuffers::WIPOffset<NdbProfileRecord<'a>>, 621 ) { 622 fbb.finish(root, None); 623 } 624 625 #[inline] 626 pub fn finish_size_prefixed_ndb_profile_record_buffer<'a, 'b>( 627 fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, 628 root: flatbuffers::WIPOffset<NdbProfileRecord<'a>>, 629 ) { 630 fbb.finish_size_prefixed(root, None); 631 }