#[repr(u8)]pub enum FeagiByteStructureType {
JSON = 1,
NeuronCategoricalXYZP = 11,
}Expand description
Represents different types of serializable data structures in the FEAGI system.
Each variant corresponds to a specific binary format with a unique byte identifier. The enum values are used as the first byte in serialized data to identify the structure type.
§Example
use feagi_serialization::FeagiByteStructureType;
let json_type = FeagiByteStructureType::JSON;
assert_eq!(json_type as u8, 1);
let neuron_type = FeagiByteStructureType::NeuronCategoricalXYZP;
assert_eq!(neuron_type as u8, 11);Variants§
JSON = 1
JSON serialization format (human-readable text)
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>
Determines the structure type from the first byte of a byte array.
§Example
use feagi_serialization::FeagiByteStructureType;
let bytes = [1u8, 2, 3, 4];
let structure_type = FeagiByteStructureType::try_get_type_from_bytes(&bytes).unwrap();
assert_eq!(structure_type, FeagiByteStructureType::JSON);
let empty_bytes = [];
assert!(FeagiByteStructureType::try_get_type_from_bytes(&empty_bytes).is_err());Sourcepub fn create_new_struct_of_type(&self) -> Box<dyn FeagiSerializable>
pub fn create_new_struct_of_type(&self) -> Box<dyn FeagiSerializable>
Creates a new empty instance of the serializable structure for this type.
§Example
use feagi_serialization::FeagiByteStructureType;
let json_type = FeagiByteStructureType::JSON;
let json_struct = json_type.create_new_struct_of_type();
assert_eq!(json_struct.get_type(), FeagiByteStructureType::JSON);
let neuron_type = FeagiByteStructureType::NeuronCategoricalXYZP;
let neuron_struct = neuron_type.create_new_struct_of_type();
assert_eq!(neuron_struct.get_type(), FeagiByteStructureType::NeuronCategoricalXYZP);Trait Implementations§
Source§impl Clone for FeagiByteStructureType
impl Clone for FeagiByteStructureType
Source§fn clone(&self) -> FeagiByteStructureType
fn clone(&self) -> FeagiByteStructureType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FeagiByteStructureType
impl Debug for FeagiByteStructureType
Source§impl Display for FeagiByteStructureType
impl Display for FeagiByteStructureType
Source§impl Hash for FeagiByteStructureType
impl Hash 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
The type returned in the event of a conversion error.
impl Copy for FeagiByteStructureType
impl Eq for FeagiByteStructureType
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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