#[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 dataVariants§
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
impl FeagiByteStructureType
Sourcepub fn try_get_type_from_bytes(
bytes: &[u8],
) -> Result<FeagiByteStructureType, FeagiDataError>
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 typeErr(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
impl Debug for FeagiByteStructureType
Source§impl Display for FeagiByteStructureType
impl Display for FeagiByteStructureType
Source§impl PartialEq for FeagiByteStructureType
impl PartialEq for FeagiByteStructureType
Source§impl TryFrom<u8> for FeagiByteStructureType
impl TryFrom<u8> for FeagiByteStructureType
Source§type Error = FeagiDataError
type Error = FeagiDataError
impl StructuralPartialEq for FeagiByteStructureType
Auto Trait Implementations§
impl Freeze for FeagiByteStructureType
impl RefUnwindSafe for FeagiByteStructureType
impl Send for FeagiByteStructureType
impl Sync for FeagiByteStructureType
impl Unpin for FeagiByteStructureType
impl UnwindSafe for FeagiByteStructureType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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