// automatically generated by the FlatBuffers compiler, do not modify
extern crate flatbuffers;
use std::mem;
use std::cmp::Ordering;
use self::flatbuffers::{EndianScalar, Follow};
use super::*;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MIN_SKELETON_BONE: u8 = 0;
#[deprecated(since = "2.0.0", note = "Use associated constants instead. This will no longer be generated in 2021.")]
pub const ENUM_MAX_SKELETON_BONE: u8 = 19;
#[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_SKELETON_BONE: [SkeletonBone; 20] = [
  SkeletonBone::NONE,
  SkeletonBone::HEAD,
  SkeletonBone::NECK,
  SkeletonBone::TORSO,
  SkeletonBone::CHEST,
  SkeletonBone::WAIST,
  SkeletonBone::HIP_OFFSET,
  SkeletonBone::HIPS_WIDTH,
  SkeletonBone::LEGS_LENGTH,
  SkeletonBone::KNEE_HEIGHT,
  SkeletonBone::FOOT_LENGTH,
  SkeletonBone::FOOT_OFFSET,
  SkeletonBone::SKELETON_OFFSET,
  SkeletonBone::CONTROLLER_DISTANCE_Z,
  SkeletonBone::CONTROLLER_DISTANCE_Y,
  SkeletonBone::FOREARM_LENGTH,
  SkeletonBone::SHOULDERS_DISTANCE,
  SkeletonBone::SHOULDERS_WIDTH,
  SkeletonBone::UPPER_ARM_LENGTH,
  SkeletonBone::ELBOW_OFFSET,
];

#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
#[repr(transparent)]
pub struct SkeletonBone(pub u8);
#[allow(non_upper_case_globals)]
impl SkeletonBone {
  pub const NONE: Self = Self(0);
  pub const HEAD: Self = Self(1);
  pub const NECK: Self = Self(2);
  pub const TORSO: Self = Self(3);
  pub const CHEST: Self = Self(4);
  pub const WAIST: Self = Self(5);
  pub const HIP_OFFSET: Self = Self(6);
  pub const HIPS_WIDTH: Self = Self(7);
  pub const LEGS_LENGTH: Self = Self(8);
  pub const KNEE_HEIGHT: Self = Self(9);
  pub const FOOT_LENGTH: Self = Self(10);
  pub const FOOT_OFFSET: Self = Self(11);
  pub const SKELETON_OFFSET: Self = Self(12);
  pub const CONTROLLER_DISTANCE_Z: Self = Self(13);
  pub const CONTROLLER_DISTANCE_Y: Self = Self(14);
  pub const FOREARM_LENGTH: Self = Self(15);
  pub const SHOULDERS_DISTANCE: Self = Self(16);
  pub const SHOULDERS_WIDTH: Self = Self(17);
  pub const UPPER_ARM_LENGTH: Self = Self(18);
  pub const ELBOW_OFFSET: Self = Self(19);

  pub const ENUM_MIN: u8 = 0;
  pub const ENUM_MAX: u8 = 19;
  pub const ENUM_VALUES: &'static [Self] = &[
    Self::NONE,
    Self::HEAD,
    Self::NECK,
    Self::TORSO,
    Self::CHEST,
    Self::WAIST,
    Self::HIP_OFFSET,
    Self::HIPS_WIDTH,
    Self::LEGS_LENGTH,
    Self::KNEE_HEIGHT,
    Self::FOOT_LENGTH,
    Self::FOOT_OFFSET,
    Self::SKELETON_OFFSET,
    Self::CONTROLLER_DISTANCE_Z,
    Self::CONTROLLER_DISTANCE_Y,
    Self::FOREARM_LENGTH,
    Self::SHOULDERS_DISTANCE,
    Self::SHOULDERS_WIDTH,
    Self::UPPER_ARM_LENGTH,
    Self::ELBOW_OFFSET,
  ];
  /// Returns the variant's name or "" if unknown.
  pub fn variant_name(self) -> Option<&'static str> {
    match self {
      Self::NONE => Some("NONE"),
      Self::HEAD => Some("HEAD"),
      Self::NECK => Some("NECK"),
      Self::TORSO => Some("TORSO"),
      Self::CHEST => Some("CHEST"),
      Self::WAIST => Some("WAIST"),
      Self::HIP_OFFSET => Some("HIP_OFFSET"),
      Self::HIPS_WIDTH => Some("HIPS_WIDTH"),
      Self::LEGS_LENGTH => Some("LEGS_LENGTH"),
      Self::KNEE_HEIGHT => Some("KNEE_HEIGHT"),
      Self::FOOT_LENGTH => Some("FOOT_LENGTH"),
      Self::FOOT_OFFSET => Some("FOOT_OFFSET"),
      Self::SKELETON_OFFSET => Some("SKELETON_OFFSET"),
      Self::CONTROLLER_DISTANCE_Z => Some("CONTROLLER_DISTANCE_Z"),
      Self::CONTROLLER_DISTANCE_Y => Some("CONTROLLER_DISTANCE_Y"),
      Self::FOREARM_LENGTH => Some("FOREARM_LENGTH"),
      Self::SHOULDERS_DISTANCE => Some("SHOULDERS_DISTANCE"),
      Self::SHOULDERS_WIDTH => Some("SHOULDERS_WIDTH"),
      Self::UPPER_ARM_LENGTH => Some("UPPER_ARM_LENGTH"),
      Self::ELBOW_OFFSET => Some("ELBOW_OFFSET"),
      _ => None,
    }
  }
}
impl std::fmt::Debug for SkeletonBone {
  fn fmt(&self, f: &mut std::fmt::Formatter) -> std::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 SkeletonBone {
  type Inner = Self;
  #[inline]
  fn follow(buf: &'a [u8], loc: usize) -> Self::Inner {
    let b = unsafe {
      flatbuffers::read_scalar_at::<u8>(buf, loc)
    };
    Self(b)
  }
}

impl flatbuffers::Push for SkeletonBone {
    type Output = SkeletonBone;
    #[inline]
    fn push(&self, dst: &mut [u8], _rest: &[u8]) {
        unsafe { flatbuffers::emplace_scalar::<u8>(dst, self.0); }
    }
}

impl flatbuffers::EndianScalar for SkeletonBone {
  #[inline]
  fn to_little_endian(self) -> Self {
    let b = u8::to_le(self.0);
    Self(b)
  }
  #[inline]
  #[allow(clippy::wrong_self_convention)]
  fn from_little_endian(self) -> Self {
    let b = u8::from_le(self.0);
    Self(b)
  }
}

impl<'a> flatbuffers::Verifiable for SkeletonBone {
  #[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 SkeletonBone {}
