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_GEOMETRY_TYPE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_GEOMETRY_TYPE: u8 = 17;
#[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_GEOMETRY_TYPE: [GeometryType; 18] = [
GeometryType::Unknown,
GeometryType::Point,
GeometryType::LineString,
GeometryType::Polygon,
GeometryType::MultiPoint,
GeometryType::MultiLineString,
GeometryType::MultiPolygon,
GeometryType::GeometryCollection,
GeometryType::CircularString,
GeometryType::CompoundCurve,
GeometryType::CurvePolygon,
GeometryType::MultiCurve,
GeometryType::MultiSurface,
GeometryType::Curve,
GeometryType::Surface,
GeometryType::PolyhedralSurface,
GeometryType::TIN,
GeometryType::Triangle,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct GeometryType(pub u8);
#[allow(non_upper_case_globals)]
impl GeometryType {
pub const Unknown: Self = Self(0);
pub const Point: Self = Self(1);
pub const LineString: Self = Self(2);
pub const Polygon: Self = Self(3);
pub const MultiPoint: Self = Self(4);
pub const MultiLineString: Self = Self(5);
pub const MultiPolygon: Self = Self(6);
pub const GeometryCollection: Self = Self(7);
pub const CircularString: Self = Self(8);
pub const CompoundCurve: Self = Self(9);
pub const CurvePolygon: Self = Self(10);
pub const MultiCurve: Self = Self(11);
pub const MultiSurface: Self = Self(12);
pub const Curve: Self = Self(13);
pub const Surface: Self = Self(14);
pub const PolyhedralSurface: Self = Self(15);
pub const TIN: Self = Self(16);
pub const Triangle: Self = Self(17);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 17;
pub const ENUM_VALUES: &'static [Self] = &[
Self::Unknown,
Self::Point,
Self::LineString,
Self::Polygon,
Self::MultiPoint,
Self::MultiLineString,
Self::MultiPolygon,
Self::GeometryCollection,
Self::CircularString,
Self::CompoundCurve,
Self::CurvePolygon,
Self::MultiCurve,
Self::MultiSurface,
Self::Curve,
Self::Surface,
Self::PolyhedralSurface,
Self::TIN,
Self::Triangle,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::Unknown => Some("Unknown"),
Self::Point => Some("Point"),
Self::LineString => Some("LineString"),
Self::Polygon => Some("Polygon"),
Self::MultiPoint => Some("MultiPoint"),
Self::MultiLineString => Some("MultiLineString"),
Self::MultiPolygon => Some("MultiPolygon"),
Self::GeometryCollection => Some("GeometryCollection"),
Self::CircularString => Some("CircularString"),
Self::CompoundCurve => Some("CompoundCurve"),
Self::CurvePolygon => Some("CurvePolygon"),
Self::MultiCurve => Some("MultiCurve"),
Self::MultiSurface => Some("MultiSurface"),
Self::Curve => Some("Curve"),
Self::Surface => Some("Surface"),
Self::PolyhedralSurface => Some("PolyhedralSurface"),
Self::TIN => Some("TIN"),
Self::Triangle => Some("Triangle"),
_ => None,
}
}
}
impl core::fmt::Debug for GeometryType {
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!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for GeometryType {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for GeometryType {
type Output = GeometryType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for GeometryType {
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 GeometryType {
#[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 GeometryType {}
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_COLUMN_TYPE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_COLUMN_TYPE: u8 = 14;
#[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_COLUMN_TYPE: [ColumnType; 15] = [
ColumnType::Byte,
ColumnType::UByte,
ColumnType::Bool,
ColumnType::Short,
ColumnType::UShort,
ColumnType::Int,
ColumnType::UInt,
ColumnType::Long,
ColumnType::ULong,
ColumnType::Float,
ColumnType::Double,
ColumnType::String,
ColumnType::Json,
ColumnType::DateTime,
ColumnType::Binary,
];
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct ColumnType(pub u8);
#[allow(non_upper_case_globals)]
impl ColumnType {
pub const Byte: Self = Self(0);
pub const UByte: Self = Self(1);
pub const Bool: Self = Self(2);
pub const Short: Self = Self(3);
pub const UShort: Self = Self(4);
pub const Int: Self = Self(5);
pub const UInt: Self = Self(6);
pub const Long: Self = Self(7);
pub const ULong: Self = Self(8);
pub const Float: Self = Self(9);
pub const Double: Self = Self(10);
pub const String: Self = Self(11);
pub const Json: Self = Self(12);
pub const DateTime: Self = Self(13);
pub const Binary: Self = Self(14);
pub const ENUM_MIN: u8 = 0;
pub const ENUM_MAX: u8 = 14;
pub const ENUM_VALUES: &'static [Self] = &[
Self::Byte,
Self::UByte,
Self::Bool,
Self::Short,
Self::UShort,
Self::Int,
Self::UInt,
Self::Long,
Self::ULong,
Self::Float,
Self::Double,
Self::String,
Self::Json,
Self::DateTime,
Self::Binary,
];
pub fn variant_name(self) -> Option<&'static str> {
match self {
Self::Byte => Some("Byte"),
Self::UByte => Some("UByte"),
Self::Bool => Some("Bool"),
Self::Short => Some("Short"),
Self::UShort => Some("UShort"),
Self::Int => Some("Int"),
Self::UInt => Some("UInt"),
Self::Long => Some("Long"),
Self::ULong => Some("ULong"),
Self::Float => Some("Float"),
Self::Double => Some("Double"),
Self::String => Some("String"),
Self::Json => Some("Json"),
Self::DateTime => Some("DateTime"),
Self::Binary => Some("Binary"),
_ => None,
}
}
}
impl core::fmt::Debug for ColumnType {
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!("<UNKNOWN {:?}>", self.0))
}
}
}
impl<'a> flatbuffers::Follow<'a> for ColumnType {
type Inner = Self;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
let b = flatbuffers::read_scalar_at::<u8>(buf, loc);
Self(b)
}
}
impl flatbuffers::Push for ColumnType {
type Output = ColumnType;
#[inline]
unsafe fn push(&self, dst: &mut [u8], _written_len: usize) {
flatbuffers::emplace_scalar::<u8>(dst, self.0);
}
}
impl flatbuffers::EndianScalar for ColumnType {
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 ColumnType {
#[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 ColumnType {}
pub enum ColumnOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Column<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Column<'a> {
type Inner = Column<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Column<'a> {
pub const VT_NAME: flatbuffers::VOffsetT = 4;
pub const VT_TYPE_: flatbuffers::VOffsetT = 6;
pub const VT_TITLE: flatbuffers::VOffsetT = 8;
pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 10;
pub const VT_WIDTH: flatbuffers::VOffsetT = 12;
pub const VT_PRECISION: flatbuffers::VOffsetT = 14;
pub const VT_SCALE: flatbuffers::VOffsetT = 16;
pub const VT_NULLABLE: flatbuffers::VOffsetT = 18;
pub const VT_UNIQUE: flatbuffers::VOffsetT = 20;
pub const VT_PRIMARY_KEY: flatbuffers::VOffsetT = 22;
pub const VT_METADATA: flatbuffers::VOffsetT = 24;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Column { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args ColumnArgs<'args>
) -> flatbuffers::WIPOffset<Column<'bldr>> {
let mut builder = ColumnBuilder::new(_fbb);
if let Some(x) = args.metadata { builder.add_metadata(x); }
builder.add_scale(args.scale);
builder.add_precision(args.precision);
builder.add_width(args.width);
if let Some(x) = args.description { builder.add_description(x); }
if let Some(x) = args.title { builder.add_title(x); }
if let Some(x) = args.name { builder.add_name(x); }
builder.add_primary_key(args.primary_key);
builder.add_unique(args.unique);
builder.add_nullable(args.nullable);
builder.add_type_(args.type_);
builder.finish()
}
#[inline]
pub fn name(&self) -> &'a str {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Column::VT_NAME, None).unwrap()}
}
#[inline]
pub fn type_(&self) -> ColumnType {
unsafe { self._tab.get::<ColumnType>(Column::VT_TYPE_, Some(ColumnType::Byte)).unwrap()}
}
#[inline]
pub fn title(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Column::VT_TITLE, None)}
}
#[inline]
pub fn description(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Column::VT_DESCRIPTION, None)}
}
#[inline]
pub fn width(&self) -> i32 {
unsafe { self._tab.get::<i32>(Column::VT_WIDTH, Some(-1)).unwrap()}
}
#[inline]
pub fn precision(&self) -> i32 {
unsafe { self._tab.get::<i32>(Column::VT_PRECISION, Some(-1)).unwrap()}
}
#[inline]
pub fn scale(&self) -> i32 {
unsafe { self._tab.get::<i32>(Column::VT_SCALE, Some(-1)).unwrap()}
}
#[inline]
pub fn nullable(&self) -> bool {
unsafe { self._tab.get::<bool>(Column::VT_NULLABLE, Some(true)).unwrap()}
}
#[inline]
pub fn unique(&self) -> bool {
unsafe { self._tab.get::<bool>(Column::VT_UNIQUE, Some(false)).unwrap()}
}
#[inline]
pub fn primary_key(&self) -> bool {
unsafe { self._tab.get::<bool>(Column::VT_PRIMARY_KEY, Some(false)).unwrap()}
}
#[inline]
pub fn metadata(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Column::VT_METADATA, None)}
}
}
impl flatbuffers::Verifiable for Column<'_> {
#[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<&str>>("name", Self::VT_NAME, true)?
.visit_field::<ColumnType>("type_", Self::VT_TYPE_, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("title", Self::VT_TITLE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("description", Self::VT_DESCRIPTION, false)?
.visit_field::<i32>("width", Self::VT_WIDTH, false)?
.visit_field::<i32>("precision", Self::VT_PRECISION, false)?
.visit_field::<i32>("scale", Self::VT_SCALE, false)?
.visit_field::<bool>("nullable", Self::VT_NULLABLE, false)?
.visit_field::<bool>("unique", Self::VT_UNIQUE, false)?
.visit_field::<bool>("primary_key", Self::VT_PRIMARY_KEY, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("metadata", Self::VT_METADATA, false)?
.finish();
Ok(())
}
}
pub struct ColumnArgs<'a> {
pub name: Option<flatbuffers::WIPOffset<&'a str>>,
pub type_: ColumnType,
pub title: Option<flatbuffers::WIPOffset<&'a str>>,
pub description: Option<flatbuffers::WIPOffset<&'a str>>,
pub width: i32,
pub precision: i32,
pub scale: i32,
pub nullable: bool,
pub unique: bool,
pub primary_key: bool,
pub metadata: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for ColumnArgs<'a> {
#[inline]
fn default() -> Self {
ColumnArgs {
name: None, type_: ColumnType::Byte,
title: None,
description: None,
width: -1,
precision: -1,
scale: -1,
nullable: true,
unique: false,
primary_key: false,
metadata: None,
}
}
}
pub struct ColumnBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> ColumnBuilder<'a, 'b> {
#[inline]
pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Column::VT_NAME, name);
}
#[inline]
pub fn add_type_(&mut self, type_: ColumnType) {
self.fbb_.push_slot::<ColumnType>(Column::VT_TYPE_, type_, ColumnType::Byte);
}
#[inline]
pub fn add_title(&mut self, title: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Column::VT_TITLE, title);
}
#[inline]
pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Column::VT_DESCRIPTION, description);
}
#[inline]
pub fn add_width(&mut self, width: i32) {
self.fbb_.push_slot::<i32>(Column::VT_WIDTH, width, -1);
}
#[inline]
pub fn add_precision(&mut self, precision: i32) {
self.fbb_.push_slot::<i32>(Column::VT_PRECISION, precision, -1);
}
#[inline]
pub fn add_scale(&mut self, scale: i32) {
self.fbb_.push_slot::<i32>(Column::VT_SCALE, scale, -1);
}
#[inline]
pub fn add_nullable(&mut self, nullable: bool) {
self.fbb_.push_slot::<bool>(Column::VT_NULLABLE, nullable, true);
}
#[inline]
pub fn add_unique(&mut self, unique: bool) {
self.fbb_.push_slot::<bool>(Column::VT_UNIQUE, unique, false);
}
#[inline]
pub fn add_primary_key(&mut self, primary_key: bool) {
self.fbb_.push_slot::<bool>(Column::VT_PRIMARY_KEY, primary_key, false);
}
#[inline]
pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Column::VT_METADATA, metadata);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> ColumnBuilder<'a, 'b> {
let start = _fbb.start_table();
ColumnBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Column<'a>> {
let o = self.fbb_.end_table(self.start_);
self.fbb_.required(o, Column::VT_NAME,"name");
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Column<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Column");
ds.field("name", &self.name());
ds.field("type_", &self.type_());
ds.field("title", &self.title());
ds.field("description", &self.description());
ds.field("width", &self.width());
ds.field("precision", &self.precision());
ds.field("scale", &self.scale());
ds.field("nullable", &self.nullable());
ds.field("unique", &self.unique());
ds.field("primary_key", &self.primary_key());
ds.field("metadata", &self.metadata());
ds.finish()
}
}
pub enum CrsOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Crs<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Crs<'a> {
type Inner = Crs<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Crs<'a> {
pub const VT_ORG: flatbuffers::VOffsetT = 4;
pub const VT_CODE: flatbuffers::VOffsetT = 6;
pub const VT_NAME: flatbuffers::VOffsetT = 8;
pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 10;
pub const VT_WKT: flatbuffers::VOffsetT = 12;
pub const VT_CODE_STRING: flatbuffers::VOffsetT = 14;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Crs { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args CrsArgs<'args>
) -> flatbuffers::WIPOffset<Crs<'bldr>> {
let mut builder = CrsBuilder::new(_fbb);
if let Some(x) = args.code_string { builder.add_code_string(x); }
if let Some(x) = args.wkt { builder.add_wkt(x); }
if let Some(x) = args.description { builder.add_description(x); }
if let Some(x) = args.name { builder.add_name(x); }
builder.add_code(args.code);
if let Some(x) = args.org { builder.add_org(x); }
builder.finish()
}
#[inline]
pub fn org(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Crs::VT_ORG, None)}
}
#[inline]
pub fn code(&self) -> i32 {
unsafe { self._tab.get::<i32>(Crs::VT_CODE, Some(0)).unwrap()}
}
#[inline]
pub fn name(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Crs::VT_NAME, None)}
}
#[inline]
pub fn description(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Crs::VT_DESCRIPTION, None)}
}
#[inline]
pub fn wkt(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Crs::VT_WKT, None)}
}
#[inline]
pub fn code_string(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Crs::VT_CODE_STRING, None)}
}
}
impl flatbuffers::Verifiable for Crs<'_> {
#[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<&str>>("org", Self::VT_ORG, false)?
.visit_field::<i32>("code", Self::VT_CODE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("name", Self::VT_NAME, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("description", Self::VT_DESCRIPTION, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("wkt", Self::VT_WKT, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("code_string", Self::VT_CODE_STRING, false)?
.finish();
Ok(())
}
}
pub struct CrsArgs<'a> {
pub org: Option<flatbuffers::WIPOffset<&'a str>>,
pub code: i32,
pub name: Option<flatbuffers::WIPOffset<&'a str>>,
pub description: Option<flatbuffers::WIPOffset<&'a str>>,
pub wkt: Option<flatbuffers::WIPOffset<&'a str>>,
pub code_string: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for CrsArgs<'a> {
#[inline]
fn default() -> Self {
CrsArgs {
org: None,
code: 0,
name: None,
description: None,
wkt: None,
code_string: None,
}
}
}
pub struct CrsBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> CrsBuilder<'a, 'b> {
#[inline]
pub fn add_org(&mut self, org: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Crs::VT_ORG, org);
}
#[inline]
pub fn add_code(&mut self, code: i32) {
self.fbb_.push_slot::<i32>(Crs::VT_CODE, code, 0);
}
#[inline]
pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Crs::VT_NAME, name);
}
#[inline]
pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Crs::VT_DESCRIPTION, description);
}
#[inline]
pub fn add_wkt(&mut self, wkt: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Crs::VT_WKT, wkt);
}
#[inline]
pub fn add_code_string(&mut self, code_string: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Crs::VT_CODE_STRING, code_string);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> CrsBuilder<'a, 'b> {
let start = _fbb.start_table();
CrsBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Crs<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Crs<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Crs");
ds.field("org", &self.org());
ds.field("code", &self.code());
ds.field("name", &self.name());
ds.field("description", &self.description());
ds.field("wkt", &self.wkt());
ds.field("code_string", &self.code_string());
ds.finish()
}
}
pub enum HeaderOffset {}
#[derive(Copy, Clone, PartialEq)]
pub struct Header<'a> {
pub _tab: flatbuffers::Table<'a>,
}
impl<'a> flatbuffers::Follow<'a> for Header<'a> {
type Inner = Header<'a>;
#[inline]
unsafe fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
Self { _tab: flatbuffers::Table::new(buf, loc) }
}
}
impl<'a> Header<'a> {
pub const VT_NAME: flatbuffers::VOffsetT = 4;
pub const VT_ENVELOPE: flatbuffers::VOffsetT = 6;
pub const VT_GEOMETRY_TYPE: flatbuffers::VOffsetT = 8;
pub const VT_HAS_Z: flatbuffers::VOffsetT = 10;
pub const VT_HAS_M: flatbuffers::VOffsetT = 12;
pub const VT_HAS_T: flatbuffers::VOffsetT = 14;
pub const VT_HAS_TM: flatbuffers::VOffsetT = 16;
pub const VT_COLUMNS: flatbuffers::VOffsetT = 18;
pub const VT_FEATURES_COUNT: flatbuffers::VOffsetT = 20;
pub const VT_INDEX_NODE_SIZE: flatbuffers::VOffsetT = 22;
pub const VT_CRS: flatbuffers::VOffsetT = 24;
pub const VT_TITLE: flatbuffers::VOffsetT = 26;
pub const VT_DESCRIPTION: flatbuffers::VOffsetT = 28;
pub const VT_METADATA: flatbuffers::VOffsetT = 30;
#[inline]
pub unsafe fn init_from_table(table: flatbuffers::Table<'a>) -> Self {
Header { _tab: table }
}
#[allow(unused_mut)]
pub fn create<'bldr: 'args, 'args: 'mut_bldr, 'mut_bldr>(
_fbb: &'mut_bldr mut flatbuffers::FlatBufferBuilder<'bldr>,
args: &'args HeaderArgs<'args>
) -> flatbuffers::WIPOffset<Header<'bldr>> {
let mut builder = HeaderBuilder::new(_fbb);
builder.add_features_count(args.features_count);
if let Some(x) = args.metadata { builder.add_metadata(x); }
if let Some(x) = args.description { builder.add_description(x); }
if let Some(x) = args.title { builder.add_title(x); }
if let Some(x) = args.crs { builder.add_crs(x); }
if let Some(x) = args.columns { builder.add_columns(x); }
if let Some(x) = args.envelope { builder.add_envelope(x); }
if let Some(x) = args.name { builder.add_name(x); }
builder.add_index_node_size(args.index_node_size);
builder.add_has_tm(args.has_tm);
builder.add_has_t(args.has_t);
builder.add_has_m(args.has_m);
builder.add_has_z(args.has_z);
builder.add_geometry_type(args.geometry_type);
builder.finish()
}
#[inline]
pub fn name(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Header::VT_NAME, None)}
}
#[inline]
pub fn envelope(&self) -> Option<flatbuffers::Vector<'a, f64>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, f64>>>(Header::VT_ENVELOPE, None)}
}
#[inline]
pub fn geometry_type(&self) -> GeometryType {
unsafe { self._tab.get::<GeometryType>(Header::VT_GEOMETRY_TYPE, Some(GeometryType::Unknown)).unwrap()}
}
#[inline]
pub fn has_z(&self) -> bool {
unsafe { self._tab.get::<bool>(Header::VT_HAS_Z, Some(false)).unwrap()}
}
#[inline]
pub fn has_m(&self) -> bool {
unsafe { self._tab.get::<bool>(Header::VT_HAS_M, Some(false)).unwrap()}
}
#[inline]
pub fn has_t(&self) -> bool {
unsafe { self._tab.get::<bool>(Header::VT_HAS_T, Some(false)).unwrap()}
}
#[inline]
pub fn has_tm(&self) -> bool {
unsafe { self._tab.get::<bool>(Header::VT_HAS_TM, Some(false)).unwrap()}
}
#[inline]
pub fn columns(&self) -> Option<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column>>>>(Header::VT_COLUMNS, None)}
}
#[inline]
pub fn features_count(&self) -> u64 {
unsafe { self._tab.get::<u64>(Header::VT_FEATURES_COUNT, Some(0)).unwrap()}
}
#[inline]
pub fn index_node_size(&self) -> u16 {
unsafe { self._tab.get::<u16>(Header::VT_INDEX_NODE_SIZE, Some(16)).unwrap()}
}
#[inline]
pub fn crs(&self) -> Option<Crs<'a>> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<Crs>>(Header::VT_CRS, None)}
}
#[inline]
pub fn title(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Header::VT_TITLE, None)}
}
#[inline]
pub fn description(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Header::VT_DESCRIPTION, None)}
}
#[inline]
pub fn metadata(&self) -> Option<&'a str> {
unsafe { self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Header::VT_METADATA, None)}
}
}
impl flatbuffers::Verifiable for Header<'_> {
#[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<&str>>("name", Self::VT_NAME, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, f64>>>("envelope", Self::VT_ENVELOPE, false)?
.visit_field::<GeometryType>("geometry_type", Self::VT_GEOMETRY_TYPE, false)?
.visit_field::<bool>("has_z", Self::VT_HAS_Z, false)?
.visit_field::<bool>("has_m", Self::VT_HAS_M, false)?
.visit_field::<bool>("has_t", Self::VT_HAS_T, false)?
.visit_field::<bool>("has_tm", Self::VT_HAS_TM, false)?
.visit_field::<flatbuffers::ForwardsUOffset<flatbuffers::Vector<'_, flatbuffers::ForwardsUOffset<Column>>>>("columns", Self::VT_COLUMNS, false)?
.visit_field::<u64>("features_count", Self::VT_FEATURES_COUNT, false)?
.visit_field::<u16>("index_node_size", Self::VT_INDEX_NODE_SIZE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<Crs>>("crs", Self::VT_CRS, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("title", Self::VT_TITLE, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("description", Self::VT_DESCRIPTION, false)?
.visit_field::<flatbuffers::ForwardsUOffset<&str>>("metadata", Self::VT_METADATA, false)?
.finish();
Ok(())
}
}
pub struct HeaderArgs<'a> {
pub name: Option<flatbuffers::WIPOffset<&'a str>>,
pub envelope: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, f64>>>,
pub geometry_type: GeometryType,
pub has_z: bool,
pub has_m: bool,
pub has_t: bool,
pub has_tm: bool,
pub columns: Option<flatbuffers::WIPOffset<flatbuffers::Vector<'a, flatbuffers::ForwardsUOffset<Column<'a>>>>>,
pub features_count: u64,
pub index_node_size: u16,
pub crs: Option<flatbuffers::WIPOffset<Crs<'a>>>,
pub title: Option<flatbuffers::WIPOffset<&'a str>>,
pub description: Option<flatbuffers::WIPOffset<&'a str>>,
pub metadata: Option<flatbuffers::WIPOffset<&'a str>>,
}
impl<'a> Default for HeaderArgs<'a> {
#[inline]
fn default() -> Self {
HeaderArgs {
name: None,
envelope: None,
geometry_type: GeometryType::Unknown,
has_z: false,
has_m: false,
has_t: false,
has_tm: false,
columns: None,
features_count: 0,
index_node_size: 16,
crs: None,
title: None,
description: None,
metadata: None,
}
}
}
pub struct HeaderBuilder<'a: 'b, 'b> {
fbb_: &'b mut flatbuffers::FlatBufferBuilder<'a>,
start_: flatbuffers::WIPOffset<flatbuffers::TableUnfinishedWIPOffset>,
}
impl<'a: 'b, 'b> HeaderBuilder<'a, 'b> {
#[inline]
pub fn add_name(&mut self, name: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_NAME, name);
}
#[inline]
pub fn add_envelope(&mut self, envelope: flatbuffers::WIPOffset<flatbuffers::Vector<'b , f64>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_ENVELOPE, envelope);
}
#[inline]
pub fn add_geometry_type(&mut self, geometry_type: GeometryType) {
self.fbb_.push_slot::<GeometryType>(Header::VT_GEOMETRY_TYPE, geometry_type, GeometryType::Unknown);
}
#[inline]
pub fn add_has_z(&mut self, has_z: bool) {
self.fbb_.push_slot::<bool>(Header::VT_HAS_Z, has_z, false);
}
#[inline]
pub fn add_has_m(&mut self, has_m: bool) {
self.fbb_.push_slot::<bool>(Header::VT_HAS_M, has_m, false);
}
#[inline]
pub fn add_has_t(&mut self, has_t: bool) {
self.fbb_.push_slot::<bool>(Header::VT_HAS_T, has_t, false);
}
#[inline]
pub fn add_has_tm(&mut self, has_tm: bool) {
self.fbb_.push_slot::<bool>(Header::VT_HAS_TM, has_tm, false);
}
#[inline]
pub fn add_columns(&mut self, columns: flatbuffers::WIPOffset<flatbuffers::Vector<'b , flatbuffers::ForwardsUOffset<Column<'b >>>>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_COLUMNS, columns);
}
#[inline]
pub fn add_features_count(&mut self, features_count: u64) {
self.fbb_.push_slot::<u64>(Header::VT_FEATURES_COUNT, features_count, 0);
}
#[inline]
pub fn add_index_node_size(&mut self, index_node_size: u16) {
self.fbb_.push_slot::<u16>(Header::VT_INDEX_NODE_SIZE, index_node_size, 16);
}
#[inline]
pub fn add_crs(&mut self, crs: flatbuffers::WIPOffset<Crs<'b >>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<Crs>>(Header::VT_CRS, crs);
}
#[inline]
pub fn add_title(&mut self, title: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_TITLE, title);
}
#[inline]
pub fn add_description(&mut self, description: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_DESCRIPTION, description);
}
#[inline]
pub fn add_metadata(&mut self, metadata: flatbuffers::WIPOffset<&'b str>) {
self.fbb_.push_slot_always::<flatbuffers::WIPOffset<_>>(Header::VT_METADATA, metadata);
}
#[inline]
pub fn new(_fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>) -> HeaderBuilder<'a, 'b> {
let start = _fbb.start_table();
HeaderBuilder {
fbb_: _fbb,
start_: start,
}
}
#[inline]
pub fn finish(self) -> flatbuffers::WIPOffset<Header<'a>> {
let o = self.fbb_.end_table(self.start_);
flatbuffers::WIPOffset::new(o.value())
}
}
impl core::fmt::Debug for Header<'_> {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let mut ds = f.debug_struct("Header");
ds.field("name", &self.name());
ds.field("envelope", &self.envelope());
ds.field("geometry_type", &self.geometry_type());
ds.field("has_z", &self.has_z());
ds.field("has_m", &self.has_m());
ds.field("has_t", &self.has_t());
ds.field("has_tm", &self.has_tm());
ds.field("columns", &self.columns());
ds.field("features_count", &self.features_count());
ds.field("index_node_size", &self.index_node_size());
ds.field("crs", &self.crs());
ds.field("title", &self.title());
ds.field("description", &self.description());
ds.field("metadata", &self.metadata());
ds.finish()
}
}
#[inline]
pub fn root_as_header(buf: &[u8]) -> Result<Header, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root::<Header>(buf)
}
#[inline]
pub fn size_prefixed_root_as_header(buf: &[u8]) -> Result<Header, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root::<Header>(buf)
}
#[inline]
pub fn root_as_header_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Header<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::root_with_opts::<Header<'b>>(opts, buf)
}
#[inline]
pub fn size_prefixed_root_as_header_with_opts<'b, 'o>(
opts: &'o flatbuffers::VerifierOptions,
buf: &'b [u8],
) -> Result<Header<'b>, flatbuffers::InvalidFlatbuffer> {
flatbuffers::size_prefixed_root_with_opts::<Header<'b>>(opts, buf)
}
#[inline]
pub unsafe fn root_as_header_unchecked(buf: &[u8]) -> Header {
flatbuffers::root_unchecked::<Header>(buf)
}
#[inline]
pub unsafe fn size_prefixed_root_as_header_unchecked(buf: &[u8]) -> Header {
flatbuffers::size_prefixed_root_unchecked::<Header>(buf)
}
#[inline]
pub fn finish_header_buffer<'a, 'b>(
fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>,
root: flatbuffers::WIPOffset<Header<'a>>) {
fbb.finish(root, None);
}
#[inline]
pub fn finish_size_prefixed_header_buffer<'a, 'b>(fbb: &'b mut flatbuffers::FlatBufferBuilder<'a>, root: flatbuffers::WIPOffset<Header<'a>>) {
fbb.finish_size_prefixed(root, None);
}