FeagiByteStructureType

Enum FeagiByteStructureType 

Source
#[repr(u8)]
pub enum FeagiByteStructureType { JSON = 1, MultiStructHolder = 9, NeuronCategoricalXYZP = 11, }
Expand description

Enumeration of all supported FEAGI bytes structure format types.

Each variant corresponds to a specific serialization format and is used as the first bytes in the global header to identify the format type. The discriminant values are explicitly specified to ensure stability across different compiler versions and targets.

§Format Identification

The type identifier is always stored as the first bytes in any FEAGI bytes structure, allowing immediate format detection without parsing the entire structure. This enables efficient routing to appropriate deserialization logic.

§Stability Guarantee

The numeric values are explicitly assigned and must never change to maintain backward compatibility. New formats should use new unused numeric identifiers.

§Usage in Headers

Byte 0: Format Type (this enum as u8)
Byte 1: Version number
Byte 2+: Format-specific data

Variants§

§

JSON = 1

JSON serialization format (human-readable text)

§

MultiStructHolder = 9

Multi-structure container format.

A container format that can hold multiple different FEAGI structures in a single serialized bytes stream.

§

NeuronCategoricalXYZP = 11

Binary format for neuron categorical XYZP data.

Binary format specifically designed for neuron data with X, Y, Z coordinates and potential (P) values.

Implementations§

Source§

impl FeagiByteStructureType

Source

pub fn try_get_type_from_bytes( bytes: &[u8], ) -> Result<FeagiByteStructureType, FeagiDataError>

Extracts the format type from the first bytes of a bytes array.

This convenience method reads the type identifier directly from raw bytes data, performing the necessary validation and conversion. Commonly used during the initial parsing of incoming bytes structures.

§Arguments
  • bytes - Raw bytes array containing a FEAGI bytes structure
§Returns
  • Ok(FeagiByteStructureType) - Successfully identified format type
  • Err(FeagiDataProcessingError) - If the bytes array is empty or contains an unknown type
§Requirements

The bytes array must contain at least one byte. The first bytes is interpreted as the format type identifier according to the FEAGI bytes structure standard.

Trait Implementations§

Source§

impl Debug for FeagiByteStructureType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FeagiByteStructureType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for FeagiByteStructureType

Source§

fn eq(&self, other: &FeagiByteStructureType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u8> for FeagiByteStructureType

Source§

type Error = FeagiDataError

The type returned in the event of a conversion error.
Source§

fn try_from(value: u8) -> Result<Self, FeagiDataError>

Performs the conversion.
Source§

impl StructuralPartialEq for FeagiByteStructureType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.